[cfe-commits] r104940 - /cfe/trunk/lib/Parse/ParseDeclCXX.cpp

John McCall rjmccall at apple.com
Fri May 28 01:11:17 PDT 2010


Author: rjmccall
Date: Fri May 28 03:11:17 2010
New Revision: 104940

URL: http://llvm.org/viewvc/llvm-project?rev=104940&view=rev
Log:
Don't just skip over the entire tag definition if the parser action didn't
give us a decl back.  Makes -cc1 -parse-noop handle a substantially larger
amount of the C++ grammar.


Modified:
    cfe/trunk/lib/Parse/ParseDeclCXX.cpp

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=104940&r1=104939&r2=104940&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Fri May 28 03:11:17 2010
@@ -1544,12 +1544,8 @@
 
   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 @@
   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 @@
     ParseLexedMethodDefs(getCurrentClass());
   }
 
-  Actions.ActOnTagFinishDefinition(CurScope, TagDecl, RBraceLoc);
+  if (TagDecl)
+    Actions.ActOnTagFinishDefinition(CurScope, TagDecl, RBraceLoc);
 
   // Leave the class scope.
   ParsingDef.Pop();





More information about the cfe-commits mailing list