mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-04 06:26:28 +00:00
Add a pointer to the owning LLVMContext to Module. This requires threading LLVMContext through a lot
of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools. Patches for Clang and LLVM-GCC to follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74614 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -115,7 +115,7 @@ Linker::LinkInArchive(const sys::Path &Filename, bool &is_native) {
|
||||
|
||||
std::string ErrMsg;
|
||||
std::auto_ptr<Archive> AutoArch (
|
||||
Archive::OpenAndLoadSymbols(Filename,&ErrMsg));
|
||||
Archive::OpenAndLoadSymbols(Filename, Context, &ErrMsg));
|
||||
|
||||
Archive* arch = AutoArch.get();
|
||||
|
||||
|
@@ -160,7 +160,7 @@ bool Linker::LinkInFile(const sys::Path &File, bool &is_native) {
|
||||
if (File.toString() == "-") {
|
||||
std::auto_ptr<Module> M;
|
||||
if (MemoryBuffer *Buffer = MemoryBuffer::getSTDIN()) {
|
||||
M.reset(ParseBitcodeFile(Buffer, &Error));
|
||||
M.reset(ParseBitcodeFile(Buffer, Context, &Error));
|
||||
delete Buffer;
|
||||
if (M.get())
|
||||
if (!LinkInModule(M.get(), &Error))
|
||||
|
@@ -20,24 +20,21 @@
|
||||
using namespace llvm;
|
||||
|
||||
Linker::Linker(const std::string& progname, const std::string& modname,
|
||||
unsigned flags)
|
||||
: Composite(0)
|
||||
, LibPaths()
|
||||
, Flags(flags)
|
||||
, Error()
|
||||
, ProgramName(progname)
|
||||
{
|
||||
Composite = new Module(modname);
|
||||
}
|
||||
LLVMContext* C, unsigned flags):
|
||||
Context(C),
|
||||
Composite(new Module(modname, C)),
|
||||
LibPaths(),
|
||||
Flags(flags),
|
||||
Error(),
|
||||
ProgramName(progname) { }
|
||||
|
||||
Linker::Linker(const std::string& progname, Module* aModule, unsigned flags)
|
||||
: Composite(aModule)
|
||||
, LibPaths()
|
||||
, Flags(flags)
|
||||
, Error()
|
||||
, ProgramName(progname)
|
||||
{
|
||||
}
|
||||
Linker::Linker(const std::string& progname, Module* aModule, unsigned flags) :
|
||||
Context(aModule->getContext()),
|
||||
Composite(aModule),
|
||||
LibPaths(),
|
||||
Flags(flags),
|
||||
Error(),
|
||||
ProgramName(progname) { }
|
||||
|
||||
Linker::~Linker() {
|
||||
delete Composite;
|
||||
@@ -106,7 +103,7 @@ Linker::LoadObject(const sys::Path &FN) {
|
||||
const std::string &FNS = FN.toString();
|
||||
std::auto_ptr<MemoryBuffer> Buffer(MemoryBuffer::getFileOrSTDIN(FNS.c_str()));
|
||||
if (Buffer.get())
|
||||
Result = ParseBitcodeFile(Buffer.get(), &ParseErrorMessage);
|
||||
Result = ParseBitcodeFile(Buffer.get(), Context, &ParseErrorMessage);
|
||||
else
|
||||
ParseErrorMessage = "Error reading file '" + FNS + "'";
|
||||
|
||||
|
Reference in New Issue
Block a user