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
diff --git a/CodeGen/CodeGenModule.cpp b/CodeGen/CodeGenModule.cpp
index 9a65d2e..bb61dc7 100644
--- a/CodeGen/CodeGenModule.cpp
+++ b/CodeGen/CodeGenModule.cpp
@@ -44,6 +44,16 @@
&Msg, 1, &Range, 1);
}
+/// WarnUnsupported - Print out a warning that codegen doesn't support the
+/// specified decl yet.
+void CodeGenModule::WarnUnsupported(const Decl *D, const char *Type) {
+ unsigned DiagID = getDiags().getCustomDiagID(Diagnostic::Warning,
+ "cannot codegen this %0 yet");
+ std::string Msg = Type;
+ getDiags().Report(Context.getFullLoc(D->getLocation()), DiagID,
+ &Msg, 1);
+}
+
/// ReplaceMapValuesWith - This is a really slow and bad function that
/// searches for any entries in GlobalDeclMap that point to OldVal, changing
/// them to point to NewVal. This is badbadbad, FIXME!
diff --git a/CodeGen/CodeGenModule.h b/CodeGen/CodeGenModule.h
index 6653e50..b86ceba 100644
--- a/CodeGen/CodeGenModule.h
+++ b/CodeGen/CodeGenModule.h
@@ -95,6 +95,10 @@
/// specified stmt yet.
void WarnUnsupported(const Stmt *S, const char *Type);
+ /// WarnUnsupported - Print out a warning that codegen doesn't support the
+ /// specified decl yet.
+ void WarnUnsupported(const Decl *D, const char *Type);
+
private:
/// ReplaceMapValuesWith - This is a really slow and bad function that
/// searches for any entries in GlobalDeclMap that point to OldVal, changing
diff --git a/CodeGen/ModuleBuilder.cpp b/CodeGen/ModuleBuilder.cpp
index 49881c3..fff5b3f 100644
--- a/CodeGen/ModuleBuilder.cpp
+++ b/CodeGen/ModuleBuilder.cpp
@@ -13,6 +13,7 @@
#include "clang/CodeGen/ModuleBuilder.h"
#include "CodeGenModule.h"
+#include "clang/AST/Decl.h"
using namespace clang;
@@ -34,6 +35,16 @@
B->EmitFunction(D);
}
+/// CodeGenLinkageSpec - Emit the specified linkage space to LLVM.
+void clang::CodeGen::CodeGenLinkageSpec(CodeGenModule *Builder,
+ LinkageSpecDecl *LS) {
+ if (LS->getLanguage() == LinkageSpecDecl::lang_cxx)
+ Builder->WarnUnsupported(LS, "linkage spec");
+
+ // FIXME: implement C++ linkage, C linkage works mostly by C
+ // language reuse already.
+}
+
/// CodeGenGlobalVar - Emit the specified global variable to LLVM.
void clang::CodeGen::CodeGenGlobalVar(CodeGenModule *Builder, FileVarDecl *D) {
Builder->EmitGlobalVarDeclarator(D);