summaryrefslogtreecommitdiff
path: root/utils/TableGen/LLVMCConfigurationEmitter.cpp
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2010-08-13 06:02:45 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2010-08-13 06:02:45 +0000
commitaa1a373a66fdc9602baa01b5405f6da69b3588f2 (patch)
tree5b865fb76c07dcd87433099ead210f52756b039a /utils/TableGen/LLVMCConfigurationEmitter.cpp
parent2e58b0055d8f8fc589d8a33293f84dbecad7151c (diff)
downloadllvm-aa1a373a66fdc9602baa01b5405f6da69b3588f2.tar.gz
llvm-aa1a373a66fdc9602baa01b5405f6da69b3588f2.tar.bz2
llvm-aa1a373a66fdc9602baa01b5405f6da69b3588f2.tar.xz
Add a workaround for building with Clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111007 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/LLVMCConfigurationEmitter.cpp')
-rw-r--r--utils/TableGen/LLVMCConfigurationEmitter.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/utils/TableGen/LLVMCConfigurationEmitter.cpp b/utils/TableGen/LLVMCConfigurationEmitter.cpp
index 7a68d696f9..97dca8c6aa 100644
--- a/utils/TableGen/LLVMCConfigurationEmitter.cpp
+++ b/utils/TableGen/LLVMCConfigurationEmitter.cpp
@@ -17,6 +17,8 @@
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringSet.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/System/Path.h"
#include <algorithm>
#include <cassert>
@@ -27,6 +29,8 @@
using namespace llvm;
+extern cl::opt<std::string> InputFilename;
+
namespace {
//===----------------------------------------------------------------------===//
@@ -2974,9 +2978,18 @@ void EmitHookDeclarations(const ToolDescriptions& ToolDescs,
O << "}\n\n";
}
+std::string GetPluginName() {
+ if (!InputFilename.empty()) {
+ return sys::Path(InputFilename).getBasename();
+ }
+
+ return "";
+}
+
/// EmitRegisterPlugin - Emit code to register this plugin.
void EmitRegisterPlugin(int Priority, raw_ostream& O) {
- O << "struct Plugin : public llvmc::BasePlugin {\n\n";
+ O << "struct Plugin" << GetPluginName()
+ << " : public llvmc::BasePlugin {\n\n";
O.indent(Indent1) << "int Priority() const { return "
<< Priority << "; }\n\n";
O.indent(Indent1) << "int PreprocessOptions() const\n";
@@ -2987,7 +3000,8 @@ void EmitRegisterPlugin(int Priority, raw_ostream& O) {
<< "int PopulateCompilationGraph(CompilationGraph& graph) const\n";
O.indent(Indent1) << "{ return PopulateCompilationGraphLocal(graph); }\n"
<< "};\n\n"
- << "static llvmc::RegisterPlugin<Plugin> RP;\n\n";
+ << "static llvmc::RegisterPlugin<Plugin"
+ << GetPluginName()<< "> RP;\n\n";
}
/// EmitIncludes - Emit necessary #include directives and some