diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-12-10 00:28:41 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-12-10 00:28:41 +0000 |
commit | 006e42f0c8b65b783d565ef10b938a9e82fc02e3 (patch) | |
tree | f541c4d72facab26b9a3ca324fa9566e46310453 /include/clang/Sema/AttributeList.h | |
parent | d937c21f53587e6481589553ab4f7b557ebb6337 (diff) |
Add ability to supply additional message to availability macros,
// rdar://10095131
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146304 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Sema/AttributeList.h')
-rw-r--r-- | include/clang/Sema/AttributeList.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/include/clang/Sema/AttributeList.h b/include/clang/Sema/AttributeList.h index bcacf7aa14..0c64e2c487 100644 --- a/include/clang/Sema/AttributeList.h +++ b/include/clang/Sema/AttributeList.h @@ -85,6 +85,8 @@ private: /// \brief The location of the 'unavailable' keyword in an /// availability attribute. SourceLocation UnavailableLoc; + + const Expr *MessageExpr; /// The next attribute in the current position. AttributeList *NextInPosition; @@ -138,13 +140,15 @@ private: const AvailabilityChange &introduced, const AvailabilityChange &deprecated, const AvailabilityChange &obsoleted, - SourceLocation unavailable, + SourceLocation unavailable, + const Expr *messageExpr, bool declspec, bool cxx0x) : AttrName(attrName), ScopeName(scopeName), ParmName(parmName), AttrRange(attrRange), ScopeLoc(scopeLoc), ParmLoc(parmLoc), NumArgs(0), DeclspecAttribute(declspec), CXX0XAttribute(cxx0x), Invalid(false), UsedAsTypeAttr(false), IsAvailability(true), - UnavailableLoc(unavailable), NextInPosition(0), NextInPool(0) { + UnavailableLoc(unavailable), MessageExpr(messageExpr), + NextInPosition(0), NextInPool(0) { new (&getAvailabilitySlot(IntroducedSlot)) AvailabilityChange(introduced); new (&getAvailabilitySlot(DeprecatedSlot)) AvailabilityChange(deprecated); new (&getAvailabilitySlot(ObsoletedSlot)) AvailabilityChange(obsoleted); @@ -371,6 +375,11 @@ public: assert(getKind() == AT_availability && "Not an availability attribute"); return UnavailableLoc; } + + const Expr * getMessageExpr() const { + assert(getKind() == AT_availability && "Not an availability attribute"); + return MessageExpr; + } }; /// A factory, from which one makes pools, from which one creates @@ -492,13 +501,14 @@ public: const AvailabilityChange &deprecated, const AvailabilityChange &obsoleted, SourceLocation unavailable, + const Expr *MessageExpr, bool declspec = false, bool cxx0x = false) { void *memory = allocate(AttributeFactory::AvailabilityAllocSize); return add(new (memory) AttributeList(attrName, attrRange, scopeName, scopeLoc, parmName, parmLoc, introduced, deprecated, obsoleted, - unavailable, + unavailable, MessageExpr, declspec, cxx0x)); } @@ -616,10 +626,12 @@ public: const AvailabilityChange &deprecated, const AvailabilityChange &obsoleted, SourceLocation unavailable, + const Expr *MessageExpr, bool declspec = false, bool cxx0x = false) { AttributeList *attr = pool.create(attrName, attrRange, scopeName, scopeLoc, parmName, parmLoc, introduced, deprecated, obsoleted, unavailable, + MessageExpr, declspec, cxx0x); add(attr); return attr; |