diff options
author | Sean Hunt <scshunt@csclub.uwaterloo.ca> | 2012-06-23 05:07:58 +0000 |
---|---|---|
committer | Sean Hunt <scshunt@csclub.uwaterloo.ca> | 2012-06-23 05:07:58 +0000 |
commit | 2edf0a2520313cde900799b1eb9bd11c9c776afe (patch) | |
tree | 02bfdc2d79f4cf641b5280b9d551c49746b201a9 /lib/Parse/ParseExprCXX.cpp | |
parent | 28ad063b279378b19cb0704f977429df366a151e (diff) |
Clean up a large number of C++11 attribute parse issues, including parsing
attributes in more places where we didn't and catching a lot more issues.
This implements nearly every aspect of C++11 attribute parsing, except for:
- Attributes are permitted on explicit instantiations inside the declarator
(but not preceding the decl-spec)
- Attributes are permitted on friend declarations of functions.
- Multiple instances of the same attribute in an attribute-list (e.g.
[[noreturn, noreturn]], not [[noreturn]] [[noreturn]] which is conforming)
are allowed.
The first two are marked as expected-FIXME in the test file and the latter
is probably a defect and is currently untested.
Thanks to Richard Smith for providing the lion's share of the testcases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159072 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseExprCXX.cpp')
-rw-r--r-- | lib/Parse/ParseExprCXX.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index ef7133c8ae..39ef38fdc0 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -1296,7 +1296,12 @@ bool Parser::ParseCXXCondition(ExprResult &ExprOut, return true; } + ParsedAttributesWithRange attrs(AttrFactory); + MaybeParseCXX0XAttributes(attrs); + if (!isCXXConditionDeclaration()) { + ProhibitAttributes(attrs); + // Parse the expression. ExprOut = ParseExpression(); // expression DeclOut = 0; |