Fix assertion failure when parsing linkage specifications (PR5921),

from Keir Mierle!

llvm-svn: 95516
This commit is contained in:
Douglas Gregor 2010-02-07 08:38:28 +00:00
parent e83b3aca0b
commit b65a913c35
3 changed files with 5 additions and 1 deletions

View 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;

View 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);
}

View 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;
}