aboutsummaryrefslogtreecommitdiff
path: root/Parse/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Parse/Parser.cpp')
-rw-r--r--Parse/Parser.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Parse/Parser.cpp b/Parse/Parser.cpp
index cc2c5d90c9..eeced570bb 100644
--- a/Parse/Parser.cpp
+++ b/Parse/Parser.cpp
@@ -386,6 +386,15 @@ Parser::DeclTy *Parser::ParseDeclarationOrFunctionDefinition() {
return ParseObjCAtInterfaceDeclaration(AtLoc, DS.getAttributes());
}
+ // If the declspec consisted only of 'extern' and we have a string
+ // literal following it, this must be a C++ linkage specifier like
+ // 'extern "C"'.
+ // FIXME: This should be limited to just C++/ObjectiveC++
+ if (Tok.is(tok::string_literal) &&
+ DS.getStorageClassSpec() == DeclSpec::SCS_extern &&
+ DS.getParsedSpecifiers() == DeclSpec::PQ_StorageClassSpecifier)
+ return ParseLinkage(Declarator::FileContext);
+
// Parse the first declarator.
Declarator DeclaratorInfo(DS, Declarator::FileContext);
ParseDeclarator(DeclaratorInfo);