aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorDeLesley Hutchins <delesley@google.com>2012-03-02 22:29:50 +0000
committerDeLesley Hutchins <delesley@google.com>2012-03-02 22:29:50 +0000
commit7ec419aa8f4ff83bc8ff707b45b9bec47fef3a1a (patch)
treeaf4303eefc7f8e089aca6f8f2f94dcc62670d275 /lib/Parse/ParseDecl.cpp
parent2287c5e2352fc51cd74e8a9a7725cbf87e41c007 (diff)
Issue warning when late-parsed attributes have no declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151947 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 476f476dab..094d53fe60 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -774,10 +774,6 @@ void Parser::ParseLexedAttribute(LateParsedAttribute &LA,
ParsedAttributes Attrs(AttrFactory);
SourceLocation endLoc;
- // Late parsed attributes must be attached to Decls by hand. If there
- // are no Decls, then this was not done properly.
- assert(LA.Decls.size() > 0 && "No decls attached to late parsed attribute");
-
if (LA.Decls.size() == 1) {
Decl *D = LA.Decls[0];
@@ -802,10 +798,12 @@ void Parser::ParseLexedAttribute(LateParsedAttribute &LA,
if (HasTemplateScope) {
TempScope.Exit();
}
- } else {
+ } else if (LA.Decls.size() > 0) {
// If there are multiple decls, then the decl cannot be within the
// function scope.
ParseGNUAttributeArgs(&LA.AttrName, LA.AttrNameLoc, Attrs, &endLoc);
+ } else {
+ Diag(Tok, diag::warn_attribute_no_decl) << LA.AttrName.getName();
}
for (unsigned i = 0, ni = LA.Decls.size(); i < ni; ++i) {