[cfe-commits] r111163 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/Parser/cxx-decl.cpp

Fariborz Jahanian fjahanian at apple.com
Mon Aug 16 10:58:53 PDT 2010


Author: fjahanian
Date: Mon Aug 16 12:58:53 2010
New Revision: 111163

URL: http://llvm.org/viewvc/llvm-project?rev=111163&view=rev
Log:
Fix a crash when parsing malformed out-of-line member function 
definition. radar 8307865.

Modified:
    cfe/trunk/lib/Parse/ParseDecl.cpp
    cfe/trunk/test/Parser/cxx-decl.cpp

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=111163&r1=111162&r2=111163&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Mon Aug 16 12:58:53 2010
@@ -2727,7 +2727,10 @@
       if (Actions.ShouldEnterDeclaratorScope(getCurScope(), D.getCXXScopeSpec()))
         // Change the declaration context for name lookup, until this function
         // is exited (and the declarator has been parsed).
-        DeclScopeObj.EnterDeclaratorScope();
+        // If there was an error parsing parenthesized declarator, declarator
+        // scope may have been enterred before. Don't do it again.
+        if (!D.isInvalidType())
+          DeclScopeObj.EnterDeclaratorScope();
     }
   } else if (D.mayOmitIdentifier()) {
     // This could be something simple like "int" (in which case the declarator

Modified: cfe/trunk/test/Parser/cxx-decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-decl.cpp?rev=111163&r1=111162&r2=111163&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-decl.cpp (original)
+++ cfe/trunk/test/Parser/cxx-decl.cpp Mon Aug 16 12:58:53 2010
@@ -76,3 +76,10 @@
 }  // no ;
 
 typedef Class1<Class2> Type1; // expected-error {{cannot combine with previous 'class' declaration specifier}}
+
+// rdar : // 8307865
+struct CodeCompleteConsumer {
+};
+
+void CodeCompleteConsumer::() { // expected-error {{xpected unqualified-id}}
+} 





More information about the cfe-commits mailing list