diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-10 03:25:07 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-10 03:25:07 +0000 |
commit | c56298d87a9df507805a548d7d515e8b511df2c0 (patch) | |
tree | bd9d2feb4342dc9d8f7dc063b99b0e6be9ab29d0 /include | |
parent | 6ee326af4e77e6f05973486097884d7431f2108d (diff) |
Parsing of C++11 attributes:
* Alternative tokens (such as 'compl') are treated as identifiers in
attribute names.
* An attribute-list can start with a comma.
* An ellipsis may not be used with either of our currently-supported
C++11 attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154381 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Basic/DiagnosticParseKinds.td | 8 | ||||
-rw-r--r-- | include/clang/Parse/Parser.h | 11 |
2 files changed, 10 insertions, 9 deletions
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index 5b53223e46..c183da7a6a 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -464,10 +464,10 @@ def warn_cxx98_compat_alignas : Warning<"'alignas' is incompatible with C++98">, def warn_cxx98_compat_attribute : Warning< "attributes are incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore; -def err_cxx0x_attribute_forbids_arguments : Error< - "C++11 attribute '%0' cannot have an argument list">; -def err_cxx0x_attribute_requires_arguments : Error< - "C++11 attribute '%0' must have an argument list">; +def err_cxx11_attribute_forbids_arguments : Error< + "attribute '%0' cannot have an argument list">; +def err_cxx11_attribute_forbids_ellipsis : Error< + "attribute '%0' cannot be used as an attribute pack">; def err_attributes_not_allowed : Error<"an attribute list cannot appear here">; def err_l_square_l_square_not_attribute : Error< "C++11 only allows consecutive left square brackets when " diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index 5e070e4f36..e599207c24 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -1907,7 +1907,7 @@ private: if (getLangOpts().CPlusPlus0x && isCXX11AttributeSpecifier()) { ParsedAttributesWithRange attrs(AttrFactory); SourceLocation endLoc; - ParseCXX0XAttributes(attrs, &endLoc); + ParseCXX11Attributes(attrs, &endLoc); D.takeAttributes(attrs, endLoc); } } @@ -1915,7 +1915,7 @@ private: SourceLocation *endLoc = 0) { if (getLangOpts().CPlusPlus0x && isCXX11AttributeSpecifier()) { ParsedAttributesWithRange attrsWithRange(AttrFactory); - ParseCXX0XAttributes(attrsWithRange, endLoc); + ParseCXX11Attributes(attrsWithRange, endLoc); attrs.takeAllFrom(attrsWithRange); } } @@ -1924,13 +1924,14 @@ private: bool OuterMightBeMessageSend = false) { if (getLangOpts().CPlusPlus0x && isCXX11AttributeSpecifier(false, OuterMightBeMessageSend)) - ParseCXX0XAttributes(attrs, endLoc); + ParseCXX11Attributes(attrs, endLoc); } - void ParseCXX0XAttributeSpecifier(ParsedAttributes &attrs, + void ParseCXX11AttributeSpecifier(ParsedAttributes &attrs, SourceLocation *EndLoc = 0); - void ParseCXX0XAttributes(ParsedAttributesWithRange &attrs, + void ParseCXX11Attributes(ParsedAttributesWithRange &attrs, SourceLocation *EndLoc = 0); + IdentifierInfo *TryParseCXX11AttributeIdentifier(SourceLocation &Loc); void MaybeParseMicrosoftAttributes(ParsedAttributes &attrs, SourceLocation *endLoc = 0) { |