diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-01 16:58:40 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-01 16:58:40 +0000 |
commit | 8b477ed579794ba6d76915d56b3f448a7dd20120 (patch) | |
tree | 70d3be97f6ecf1ab7962e6cfafd113f2f7ce2579 /tools/bugpoint/BugDriver.cpp | |
parent | 4fb75e542539153acaf31d9221845a7d0feccbf6 (diff) | |
download | llvm-8b477ed579794ba6d76915d56b3f448a7dd20120.tar.gz llvm-8b477ed579794ba6d76915d56b3f448a7dd20120.tar.bz2 llvm-8b477ed579794ba6d76915d56b3f448a7dd20120.tar.xz |
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
Diffstat (limited to 'tools/bugpoint/BugDriver.cpp')
-rw-r--r-- | tools/bugpoint/BugDriver.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp index d050b59ed7..340522a443 100644 --- a/tools/bugpoint/BugDriver.cpp +++ b/tools/bugpoint/BugDriver.cpp @@ -64,24 +64,24 @@ std::string llvm::getPassesString(const std::vector<const PassInfo*> &Passes) { } BugDriver::BugDriver(const char *toolname, bool as_child, bool find_bugs, - unsigned timeout, unsigned memlimit) - : ToolName(toolname), ReferenceOutputFile(OutputFile), + unsigned timeout, unsigned memlimit, LLVMContext* ctxt) + : Context(ctxt), ToolName(toolname), ReferenceOutputFile(OutputFile), Program(0), Interpreter(0), SafeInterpreter(0), gcc(0), - run_as_child(as_child), - run_find_bugs(find_bugs), Timeout(timeout), MemoryLimit(memlimit) {} + run_as_child(as_child), run_find_bugs(find_bugs), Timeout(timeout), + MemoryLimit(memlimit) {} /// ParseInputFile - Given a bitcode or assembly input filename, parse and /// return it, or return null if not possible. /// -Module *llvm::ParseInputFile(const std::string &Filename) { +Module *llvm::ParseInputFile(const std::string &Filename, LLVMContext* Ctxt) { std::auto_ptr<MemoryBuffer> Buffer(MemoryBuffer::getFileOrSTDIN(Filename)); Module *Result = 0; if (Buffer.get()) - Result = ParseBitcodeFile(Buffer.get()); + Result = ParseBitcodeFile(Buffer.get(), Ctxt); ParseError Err; - if (!Result && !(Result = ParseAssemblyFile(Filename, Err))) { + if (!Result && !(Result = ParseAssemblyFile(Filename, Err, Ctxt))) { Err.PrintError("bugpoint", errs()); Result = 0; } @@ -100,14 +100,14 @@ bool BugDriver::addSources(const std::vector<std::string> &Filenames) { try { // Load the first input file. - Program = ParseInputFile(Filenames[0]); + Program = ParseInputFile(Filenames[0], Context); if (Program == 0) return true; if (!run_as_child) std::cout << "Read input file : '" << Filenames[0] << "'\n"; for (unsigned i = 1, e = Filenames.size(); i != e; ++i) { - std::auto_ptr<Module> M(ParseInputFile(Filenames[i])); + std::auto_ptr<Module> M(ParseInputFile(Filenames[i], Context)); if (M.get() == 0) return true; if (!run_as_child) |