[cfe-commits] r130101 - in /cfe/trunk: lib/Parse/ParseDeclCXX.cpp test/SemaTemplate/deduction-crash.cpp test/SemaTemplate/explicit-instantiation.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Sun Apr 24 09:27:48 PDT 2011


Author: cornedbee
Date: Sun Apr 24 11:27:48 2011
New Revision: 130101

URL: http://llvm.org/viewvc/llvm-project?rev=130101&view=rev
Log:
Make the invalid declarator recovery when parsing members work the same as when parsing global decls. It's still rather broken (skipping much too far when the declarator belongs to a function definition), but at least not so broken as to mismatch braces. Tested by the removal of the fixme in the template test case.

Modified:
    cfe/trunk/lib/Parse/ParseDeclCXX.cpp
    cfe/trunk/test/SemaTemplate/deduction-crash.cpp
    cfe/trunk/test/SemaTemplate/explicit-instantiation.cpp

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=130101&r1=130100&r2=130101&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Sun Apr 24 11:27:48 2011
@@ -1551,7 +1551,7 @@
     // Error parsing the declarator?
     if (!DeclaratorInfo.hasName()) {
       // If so, skip until the semi-colon or a }.
-      SkipUntil(tok::r_brace, true);
+      SkipUntil(tok::r_brace, true, true);
       if (Tok.is(tok::semi))
         ConsumeToken();
       return;

Modified: cfe/trunk/test/SemaTemplate/deduction-crash.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/deduction-crash.cpp?rev=130101&r1=130100&r2=130101&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/deduction-crash.cpp (original)
+++ cfe/trunk/test/SemaTemplate/deduction-crash.cpp Sun Apr 24 11:27:48 2011
@@ -4,7 +4,7 @@
 
 // Note that the error count below doesn't matter. We just want to
 // make sure that the parser doesn't crash.
-// CHECK: 16 errors
+// CHECK: 14 errors
 template<a>
 struct int_;
 

Modified: cfe/trunk/test/SemaTemplate/explicit-instantiation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/explicit-instantiation.cpp?rev=130101&r1=130100&r2=130101&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/explicit-instantiation.cpp (original)
+++ cfe/trunk/test/SemaTemplate/explicit-instantiation.cpp Sun Apr 24 11:27:48 2011
@@ -88,15 +88,12 @@
 inline template struct X3<int>; // expected-warning{{ignoring 'inline' keyword on explicit template instantiation}}
 static template struct X3<float>; // expected-warning{{ignoring 'static' keyword on explicit template instantiation}}
 
-namespace PR7622 { // expected-note{{to match this}}
+namespace PR7622 {
   template<typename,typename=int>
   struct basic_streambuf;
 
-  // FIXME: Very poor recovery here.
   template<typename,typename>
   struct basic_streambuf{friend bob<>()}; // expected-error{{unknown type name 'bob'}} \
   // expected-error{{ expected member name or ';' after declaration specifiers}}
-  template struct basic_streambuf<int>; // expected-error{{explicit instantiation of 'basic_streambuf' in class scope}}
-}  // expected-error{{expected ';' after struct}}
-  
-//expected-error{{expected '}'}}
+  template struct basic_streambuf<int>;
+}





More information about the cfe-commits mailing list