summaryrefslogtreecommitdiffstats
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-04-06 15:53:59 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-04-06 15:53:59 +0000
commit71438373cd57f0d5d8c93bb5cf690844a0fbc9d0 (patch)
tree59c928209f8007777dd96568b026bdfe200691de /lib/Parse/ParseDecl.cpp
parentac616af773f5062edaaf1a0bb5610b49a22ac41f (diff)
downloadFreeBSD-src-71438373cd57f0d5d8c93bb5cf690844a0fbc9d0.zip
FreeBSD-src-71438373cd57f0d5d8c93bb5cf690844a0fbc9d0.tar.gz
Update clang to r100520.
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index e87d052..c85b6ee 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -334,7 +334,7 @@ Parser::DeclGroupPtrTy Parser::ParseDeclaration(unsigned Context,
SingleDecl = ParseStaticAssertDeclaration(DeclEnd);
break;
default:
- return ParseSimpleDeclaration(Context, DeclEnd, Attr.AttrList);
+ return ParseSimpleDeclaration(Context, DeclEnd, Attr.AttrList, true);
}
// This routine returns a DeclGroup, if the thing we parsed only contains a
@@ -348,10 +348,11 @@ Parser::DeclGroupPtrTy Parser::ParseDeclaration(unsigned Context,
/// [OMP] threadprivate-directive [TODO]
///
/// If RequireSemi is false, this does not check for a ';' at the end of the
-/// declaration.
+/// declaration. If it is true, it checks for and eats it.
Parser::DeclGroupPtrTy Parser::ParseSimpleDeclaration(unsigned Context,
SourceLocation &DeclEnd,
- AttributeList *Attr) {
+ AttributeList *Attr,
+ bool RequireSemi) {
// Parse the common declaration-specifiers piece.
ParsingDeclSpec DS(*this);
if (Attr)
@@ -362,15 +363,13 @@ Parser::DeclGroupPtrTy Parser::ParseSimpleDeclaration(unsigned Context,
// C99 6.7.2.3p6: Handle "struct-or-union identifier;", "enum { X };"
// declaration-specifiers init-declarator-list[opt] ';'
if (Tok.is(tok::semi)) {
- ConsumeToken();
+ if (RequireSemi) ConsumeToken();
DeclPtrTy TheDecl = Actions.ParsedFreeStandingDeclSpec(CurScope, DS);
DS.complete(TheDecl);
return Actions.ConvertDeclToDeclGroup(TheDecl);
}
- DeclGroupPtrTy DG = ParseDeclGroup(DS, Context, /*FunctionDefs=*/ false,
- &DeclEnd);
- return DG;
+ return ParseDeclGroup(DS, Context, /*FunctionDefs=*/ false, &DeclEnd);
}
/// ParseDeclGroup - Having concluded that this is either a function
@@ -999,6 +998,10 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
DiagID, Tok.getAnnotationValue());
else
DS.SetTypeSpecError();
+
+ if (isInvalid)
+ break;
+
DS.SetRangeEnd(Tok.getAnnotationEndLoc());
ConsumeToken(); // The typename
OpenPOWER on IntegriCloud