]> granicus.if.org Git - clang/commitdiff
Don't just skip over the entire tag definition if the parser action didn't
authorJohn McCall <rjmccall@apple.com>
Fri, 28 May 2010 08:11:17 +0000 (08:11 +0000)
committerJohn McCall <rjmccall@apple.com>
Fri, 28 May 2010 08:11:17 +0000 (08:11 +0000)
give us a decl back.  Makes -cc1 -parse-noop handle a substantially larger
amount of the C++ grammar.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104940 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDeclCXX.cpp

index 479c04c37d7aaf738cfbd3d3408b48ab0ade1356..ce6147ae894e81cbdac4f0191b4344de73bb761a 100644 (file)
@@ -1544,12 +1544,8 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
 
   SourceLocation LBraceLoc = ConsumeBrace();
 
-  if (!TagDecl) {
-    SkipUntil(tok::r_brace, false, false);
-    return;
-  }
-
-  Actions.ActOnStartCXXMemberDeclarations(CurScope, TagDecl, LBraceLoc);
+  if (TagDecl)
+    Actions.ActOnStartCXXMemberDeclarations(CurScope, TagDecl, LBraceLoc);
 
   // C++ 11p3: Members of a class defined with the keyword class are private
   // by default. Members of a class defined with the keywords struct or union
@@ -1594,9 +1590,10 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
   if (Tok.is(tok::kw___attribute))
     AttrList.reset(ParseGNUAttributes());
 
-  Actions.ActOnFinishCXXMemberSpecification(CurScope, RecordLoc, TagDecl,
-                                            LBraceLoc, RBraceLoc,
-                                            AttrList.get());
+  if (TagDecl)
+    Actions.ActOnFinishCXXMemberSpecification(CurScope, RecordLoc, TagDecl,
+                                              LBraceLoc, RBraceLoc,
+                                              AttrList.get());
 
   // C++ 9.2p2: Within the class member-specification, the class is regarded as
   // complete within function bodies, default arguments,
@@ -1613,7 +1610,8 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc,
     ParseLexedMethodDefs(getCurrentClass());
   }
 
-  Actions.ActOnTagFinishDefinition(CurScope, TagDecl, RBraceLoc);
+  if (TagDecl)
+    Actions.ActOnTagFinishDefinition(CurScope, TagDecl, RBraceLoc);
 
   // Leave the class scope.
   ParsingDef.Pop();