[cfe-commits] r95516 - in /cfe/trunk: lib/Parse/ParseDeclCXX.cpp lib/Parse/Parser.cpp test/CodeGenCXX/extern-c.cpp

Douglas Gregor dgregor at apple.com
Sun Feb 7 00:38:29 PST 2010


Author: dgregor
Date: Sun Feb  7 02:38:28 2010
New Revision: 95516

URL: http://llvm.org/viewvc/llvm-project?rev=95516&view=rev
Log:
Fix assertion failure when parsing linkage specifications (PR5921),
from Keir Mierle!

Modified:
    cfe/trunk/lib/Parse/ParseDeclCXX.cpp
    cfe/trunk/lib/Parse/Parser.cpp
    cfe/trunk/test/CodeGenCXX/extern-c.cpp

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=95516&r1=95515&r2=95516&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Sun Feb  7 02:38:28 2010
@@ -191,6 +191,8 @@
                                                    SourceLocation());
   }
 
+  DS.abort();
+
   if (Attr.HasAttr)
     Diag(Attr.Range.getBegin(), diag::err_attributes_not_allowed)
       << Attr.Range;

Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=95516&r1=95515&r2=95516&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Sun Feb  7 02:38:28 2010
@@ -593,7 +593,6 @@
   if (Tok.is(tok::string_literal) && getLang().CPlusPlus &&
       DS.getStorageClassSpec() == DeclSpec::SCS_extern &&
       DS.getParsedSpecifiers() == DeclSpec::PQ_StorageClassSpecifier) {
-    DS.abort();
     DeclPtrTy TheDecl = ParseLinkage(DS, Declarator::FileContext);
     return Actions.ConvertDeclToDeclGroup(TheDecl);
   }

Modified: cfe/trunk/test/CodeGenCXX/extern-c.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/extern-c.cpp?rev=95516&r1=95515&r2=95516&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/extern-c.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/extern-c.cpp Sun Feb  7 02:38:28 2010
@@ -10,4 +10,7 @@
 // RUN: grep "@_ZN3foo1cE = global i32" %t | count 1
 int c = 5;
 
+// RUN: not grep "@_ZN3foo1dE" %t
+extern "C" struct d;
+
 }





More information about the cfe-commits mailing list