Parse all kinds of declarations as part of a linkage-specification,
from Francois Pichet! Fixes PR7754.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111912 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index e412f25..d80410c 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -197,7 +197,7 @@
if (Tok.isNot(tok::l_brace)) {
DS.setExternInLinkageSpec(true);
- ParseDeclarationOrFunctionDefinition(DS, Attr.AttrList);
+ ParseExternalDeclaration(Attr, &DS);
return Actions.ActOnFinishLinkageSpecification(getCurScope(), LinkageSpec,
SourceLocation());
}
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 2f5070c..8fd1e48 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -405,7 +405,8 @@
/// ';'
///
/// [C++0x/GNU] 'extern' 'template' declaration
-Parser::DeclGroupPtrTy Parser::ParseExternalDeclaration(CXX0XAttributeList Attr) {
+Parser::DeclGroupPtrTy Parser::ParseExternalDeclaration(CXX0XAttributeList Attr,
+ ParsingDeclSpec *DS) {
ParenBraceBracketBalancer BalancerRAIIObj(*this);
Decl *SingleDecl = 0;
@@ -494,7 +495,10 @@
default:
// We can't tell whether this is a function-definition or declaration yet.
- return ParseDeclarationOrFunctionDefinition(Attr.AttrList);
+ if (DS)
+ return ParseDeclarationOrFunctionDefinition(*DS, Attr.AttrList);
+ else
+ return ParseDeclarationOrFunctionDefinition(Attr.AttrList);
}
// This routine returns a DeclGroup, if the thing we parsed only contains a