mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-21 19:32:16 +00:00
Add a workaround for building with Clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111007 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2e58b0055d
commit
aa1a373a66
@ -17,6 +17,8 @@
|
|||||||
#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
#include "llvm/ADT/IntrusiveRefCntPtr.h"
|
||||||
#include "llvm/ADT/StringMap.h"
|
#include "llvm/ADT/StringMap.h"
|
||||||
#include "llvm/ADT/StringSet.h"
|
#include "llvm/ADT/StringSet.h"
|
||||||
|
#include "llvm/Support/CommandLine.h"
|
||||||
|
#include "llvm/System/Path.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -27,6 +29,8 @@
|
|||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
extern cl::opt<std::string> InputFilename;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -2974,9 +2978,18 @@ void EmitHookDeclarations(const ToolDescriptions& ToolDescs,
|
|||||||
O << "}\n\n";
|
O << "}\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string GetPluginName() {
|
||||||
|
if (!InputFilename.empty()) {
|
||||||
|
return sys::Path(InputFilename).getBasename();
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
/// EmitRegisterPlugin - Emit code to register this plugin.
|
/// EmitRegisterPlugin - Emit code to register this plugin.
|
||||||
void EmitRegisterPlugin(int Priority, raw_ostream& O) {
|
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 "
|
O.indent(Indent1) << "int Priority() const { return "
|
||||||
<< Priority << "; }\n\n";
|
<< Priority << "; }\n\n";
|
||||||
O.indent(Indent1) << "int PreprocessOptions() const\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";
|
<< "int PopulateCompilationGraph(CompilationGraph& graph) const\n";
|
||||||
O.indent(Indent1) << "{ return PopulateCompilationGraphLocal(graph); }\n"
|
O.indent(Indent1) << "{ return PopulateCompilationGraphLocal(graph); }\n"
|
||||||
<< "};\n\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
|
/// EmitIncludes - Emit necessary #include directives and some
|
||||||
|
@ -146,9 +146,6 @@ namespace {
|
|||||||
OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"),
|
OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"),
|
||||||
cl::init("-"));
|
cl::init("-"));
|
||||||
|
|
||||||
cl::opt<std::string>
|
|
||||||
InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"));
|
|
||||||
|
|
||||||
cl::list<std::string>
|
cl::list<std::string>
|
||||||
IncludeDirs("I", cl::desc("Directory of include files"),
|
IncludeDirs("I", cl::desc("Directory of include files"),
|
||||||
cl::value_desc("directory"), cl::Prefix);
|
cl::value_desc("directory"), cl::Prefix);
|
||||||
@ -161,6 +158,9 @@ namespace {
|
|||||||
|
|
||||||
|
|
||||||
// FIXME: Eliminate globals from tblgen.
|
// FIXME: Eliminate globals from tblgen.
|
||||||
|
cl::opt<std::string>
|
||||||
|
InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"));
|
||||||
|
|
||||||
RecordKeeper llvm::Records;
|
RecordKeeper llvm::Records;
|
||||||
|
|
||||||
static SourceMgr SrcMgr;
|
static SourceMgr SrcMgr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user