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 /Sema/SemaDecl.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 'Sema/SemaDecl.cpp')
-rw-r--r-- | Sema/SemaDecl.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index cbcd79ea4f..1610008191 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -1615,6 +1615,27 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDeclX, Enum->defineElements(EltList, BestType); } +Sema::DeclTy* Sema::ActOnLinkageSpec(SourceLocation Loc, + SourceLocation LBrace, + SourceLocation RBrace, + const char *Lang, + unsigned StrSize, + DeclTy *D) { + LinkageSpecDecl::LanguageIDs Language; + Decl *dcl = static_cast<Decl *>(D); + if (strncmp(Lang, "\"C\"", StrSize) == 0) + Language = LinkageSpecDecl::lang_c; + else if (strncmp(Lang, "\"C++\"", StrSize) == 0) + Language = LinkageSpecDecl::lang_cxx; + else { + Diag(Loc, diag::err_bad_language); + return 0; + } + + // FIXME: Add all the various semantics of linkage specifications + return new LinkageSpecDecl(Loc, Language, dcl); +} + void Sema::HandleDeclAttribute(Decl *New, AttributeList *rawAttr) { const char *attrName = rawAttr->getAttributeName()->getName(); unsigned attrLen = rawAttr->getAttributeName()->getLength(); |