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 | |
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')
-rw-r--r-- | include/clang/Basic/Attr.td | 2 | ||||
-rw-r--r-- | include/clang/Parse/Parser.h | 3 | ||||
-rw-r--r-- | include/clang/Sema/AttributeList.h | 18 |
3 files changed, 19 insertions, 4 deletions
diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 2a4ba5c6c7..0839df8baf 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -146,7 +146,7 @@ def Availability : InheritableAttr { let Spellings = ["availability"]; let Args = [IdentifierArgument<"platform">, VersionArgument<"introduced">, VersionArgument<"deprecated">, VersionArgument<"obsoleted">, - BoolArgument<"unavailable">]; + BoolArgument<"unavailable">, StringArgument<"message">]; let AdditionalMembers = [{static llvm::StringRef getPrettyPlatformName(llvm::StringRef Platform) { return llvm::StringSwitch<llvm::StringRef>(Platform) diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index 0ebf9c3a70..a60800630e 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -147,6 +147,9 @@ class Parser : public CodeCompletionHandler { /// \brief Identifier for "unavailable". IdentifierInfo *Ident_unavailable; + + /// \brief Identifier for "message". + IdentifierInfo *Ident_message; /// C++0x contextual keywords. mutable IdentifierInfo *Ident_final; 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; |