diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-01 21:22:36 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-01 21:22:36 +0000 |
commit | 31895e73591d3c9ceae731a1274c8f56194b9616 (patch) | |
tree | 9e5f714db4af7dddfab061cb0016489f6d114c56 /tools/bugpoint | |
parent | fcd65ae28fe797c174be350a07955713fd42d110 (diff) | |
download | llvm-31895e73591d3c9ceae731a1274c8f56194b9616.tar.gz llvm-31895e73591d3c9ceae731a1274c8f56194b9616.tar.bz2 llvm-31895e73591d3c9ceae731a1274c8f56194b9616.tar.xz |
Hold the LLVMContext by reference rather than by pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74640 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint')
-rw-r--r-- | tools/bugpoint/BugDriver.cpp | 6 | ||||
-rw-r--r-- | tools/bugpoint/BugDriver.h | 9 | ||||
-rw-r--r-- | tools/bugpoint/bugpoint.cpp | 2 |
3 files changed, 10 insertions, 7 deletions
diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp index 340522a443..93b09fb381 100644 --- a/tools/bugpoint/BugDriver.cpp +++ b/tools/bugpoint/BugDriver.cpp @@ -64,7 +64,8 @@ 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, LLVMContext* ctxt) + unsigned timeout, unsigned memlimit, + const 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), @@ -74,7 +75,8 @@ BugDriver::BugDriver(const char *toolname, bool as_child, bool find_bugs, /// 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, LLVMContext* Ctxt) { +Module *llvm::ParseInputFile(const std::string &Filename, + const LLVMContext& Ctxt) { std::auto_ptr<MemoryBuffer> Buffer(MemoryBuffer::getFileOrSTDIN(Filename)); Module *Result = 0; if (Buffer.get()) diff --git a/tools/bugpoint/BugDriver.h b/tools/bugpoint/BugDriver.h index 4c81cc2a2b..34267d55a6 100644 --- a/tools/bugpoint/BugDriver.h +++ b/tools/bugpoint/BugDriver.h @@ -43,7 +43,7 @@ extern bool DisableSimplifyCFG; extern bool BugpointIsInterrupted; class BugDriver { - LLVMContext* Context; + const LLVMContext& Context; const std::string ToolName; // Name of bugpoint std::string ReferenceOutputFile; // Name of `good' output file Module *Program; // The raw program, linked together @@ -62,11 +62,11 @@ class BugDriver { public: BugDriver(const char *toolname, bool as_child, bool find_bugs, - unsigned timeout, unsigned memlimit, LLVMContext* ctxt); + unsigned timeout, unsigned memlimit, const LLVMContext& ctxt); const std::string &getToolName() const { return ToolName; } - LLVMContext* getContext() { return Context; } + const LLVMContext& getContext() { return Context; } // Set up methods... these methods are used to copy information about the // command line arguments into instance variables of BugDriver. @@ -294,7 +294,8 @@ private: /// ParseInputFile - Given a bitcode or assembly input filename, parse and /// return it, or return null if not possible. /// -Module *ParseInputFile(const std::string &InputFilename, LLVMContext* ctxt); +Module *ParseInputFile(const std::string &InputFilename, + const LLVMContext& ctxt); /// getPassesString - Turn a list of passes into a string which indicates the diff --git a/tools/bugpoint/bugpoint.cpp b/tools/bugpoint/bugpoint.cpp index 57007e035c..3365b227b1 100644 --- a/tools/bugpoint/bugpoint.cpp +++ b/tools/bugpoint/bugpoint.cpp @@ -76,7 +76,7 @@ int main(int argc, char **argv) { sys::SetInterruptFunction(BugpointInterruptFunction); LLVMContext Context; - BugDriver D(argv[0], AsChild, FindBugs, TimeoutValue, MemoryLimit, &Context); + BugDriver D(argv[0], AsChild, FindBugs, TimeoutValue, MemoryLimit, Context); if (D.addSources(InputFilenames)) return 1; D.addPasses(PassList.begin(), PassList.end()); |