]> granicus.if.org Git - clang/commitdiff
Fix assertion failure when parsing linkage specifications (PR5921),
authorDouglas Gregor <dgregor@apple.com>
Sun, 7 Feb 2010 08:38:28 +0000 (08:38 +0000)
committerDouglas Gregor <dgregor@apple.com>
Sun, 7 Feb 2010 08:38:28 +0000 (08:38 +0000)
from Keir Mierle!

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

lib/Parse/ParseDeclCXX.cpp
lib/Parse/Parser.cpp
test/CodeGenCXX/extern-c.cpp

index c24bafd6d3b3bcaf295fa52b04bd90eae6378c9d..e1c66e236d897b1fa28c37e4a4a3b4ad46261e9c 100644 (file)
@@ -191,6 +191,8 @@ Parser::DeclPtrTy Parser::ParseLinkage(ParsingDeclSpec &DS,
                                                    SourceLocation());
   }
 
+  DS.abort();
+
   if (Attr.HasAttr)
     Diag(Attr.Range.getBegin(), diag::err_attributes_not_allowed)
       << Attr.Range;
index f15b39a83e6ec6f5ce6dd0328c4690fec0e4d4c8..2558b6675812252d2d42139242507c36809c6b03 100644 (file)
@@ -593,7 +593,6 @@ Parser::ParseDeclarationOrFunctionDefinition(ParsingDeclSpec &DS,
   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);
   }
index 427a45aebb1ecebb9d6e8340ae24f87c1d29b450..ca5cd7372cad858dda4024dca37505b503c59ecb 100644 (file)
@@ -10,4 +10,7 @@ extern int b;
 // RUN: grep "@_ZN3foo1cE = global i32" %t | count 1
 int c = 5;
 
+// RUN: not grep "@_ZN3foo1dE" %t
+extern "C" struct d;
+
 }