diff options
author | Chris Lattner <sabre@nondot.org> | 2008-01-12 07:05:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-01-12 07:05:38 +0000 |
commit | c6fdc34ac0183bfa03d65f317c78b7bdac52897e (patch) | |
tree | 383d24d2b5b8409ea360110b89b48d1e395b9017 /Parse/Parser.cpp | |
parent | e41b7cd768fe5722c1adcf4056d586c59514ec29 (diff) |
Add first pieces of support for parsing and representing
extern "C" in C++ mode. Patch by Mike Stump!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45904 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Parse/Parser.cpp')
-rw-r--r-- | Parse/Parser.cpp | 9 |
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); |