Make the use of const with respect to LLVMContext sane.  Hopefully this is the last time, for the
moment, that I will need to make far-reaching changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74655 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/bugpoint/BugDriver.cpp b/tools/bugpoint/BugDriver.cpp
index 93b09fb..847de1f 100644
--- a/tools/bugpoint/BugDriver.cpp
+++ b/tools/bugpoint/BugDriver.cpp
@@ -65,7 +65,7 @@
 
 BugDriver::BugDriver(const char *toolname, bool as_child, bool find_bugs,
                      unsigned timeout, unsigned memlimit,
-                     const LLVMContext& ctxt)
+                     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), 
@@ -76,7 +76,7 @@
 /// return it, or return null if not possible.
 ///
 Module *llvm::ParseInputFile(const std::string &Filename,
-                             const LLVMContext& Ctxt) {
+                             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 34267d5..d637c24 100644
--- a/tools/bugpoint/BugDriver.h
+++ b/tools/bugpoint/BugDriver.h
@@ -43,7 +43,7 @@
 extern bool BugpointIsInterrupted;
 
 class BugDriver {
-  const LLVMContext& Context;
+  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 @@
 
 public:
   BugDriver(const char *toolname, bool as_child, bool find_bugs,
-            unsigned timeout, unsigned memlimit, const LLVMContext& ctxt);
+            unsigned timeout, unsigned memlimit, LLVMContext& ctxt);
 
   const std::string &getToolName() const { return ToolName; }
 
-  const LLVMContext& getContext() { return Context; }
+  LLVMContext& getContext() { return Context; }
 
   // Set up methods... these methods are used to copy information about the
   // command line arguments into instance variables of BugDriver.
@@ -295,7 +295,7 @@
 /// return it, or return null if not possible.
 ///
 Module *ParseInputFile(const std::string &InputFilename,
-                       const LLVMContext& ctxt);
+                       LLVMContext& ctxt);
 
 
 /// getPassesString - Turn a list of passes into a string which indicates the
diff --git a/tools/llvm-db/CLIDebugger.cpp b/tools/llvm-db/CLIDebugger.cpp
index 3caa2e6..31476f7 100644
--- a/tools/llvm-db/CLIDebugger.cpp
+++ b/tools/llvm-db/CLIDebugger.cpp
@@ -22,7 +22,7 @@
 /// CLIDebugger constructor - This initializes the debugger to its default
 /// state, and initializes the command table.
 ///
-CLIDebugger::CLIDebugger(const LLVMContext& ctxt)
+CLIDebugger::CLIDebugger(LLVMContext& ctxt)
   : Context(ctxt), TheProgramInfo(0), TheRuntimeInfo(0),
     Prompt("(llvm-db) "), ListSize(10) {
   // Initialize instance variables
diff --git a/tools/llvm-db/CLIDebugger.h b/tools/llvm-db/CLIDebugger.h
index a5c73bd..9904559 100644
--- a/tools/llvm-db/CLIDebugger.h
+++ b/tools/llvm-db/CLIDebugger.h
@@ -29,7 +29,7 @@
   /// CLIDebugger - This class implements the command line interface for the
   /// LLVM debugger.
   class CLIDebugger {
-    const LLVMContext& Context;
+    LLVMContext& Context;
     
     /// Dbg - The low-level LLVM debugger object that we use to do our dirty
     /// work.
@@ -82,7 +82,7 @@
     const SourceLanguage *CurrentLanguage;
 
   public:
-    CLIDebugger(const LLVMContext& ctxt);
+    CLIDebugger(LLVMContext& ctxt);
 
     /// getDebugger - Return the current LLVM debugger implementation being
     /// used.
diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp
index 818df14..f65e602 100644
--- a/tools/llvm-link/llvm-link.cpp
+++ b/tools/llvm-link/llvm-link.cpp
@@ -49,7 +49,7 @@
 // searches the link path for the specified file to try to find it...
 //
 static inline std::auto_ptr<Module> LoadFile(const std::string &FN, 
-                                             const LLVMContext& Context) {
+                                             LLVMContext& Context) {
   sys::Path Filename;
   if (!Filename.set(FN)) {
     cerr << "Invalid file name: '" << FN << "'\n";
diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp
index faac33b..6f5e6bc 100644
--- a/tools/lto/LTOCodeGenerator.cpp
+++ b/tools/lto/LTOCodeGenerator.cpp
@@ -69,7 +69,7 @@
 }
 
 
-LTOCodeGenerator::LTOCodeGenerator(const LLVMContext& Context) 
+LTOCodeGenerator::LTOCodeGenerator(LLVMContext& Context) 
     : _context(Context),
       _linker("LinkTimeOptimizer", "ld-temp.o", _context), _target(NULL),
       _emitDwarfDebugInfo(false), _scopeRestrictionsDone(false),
diff --git a/tools/lto/LTOCodeGenerator.h b/tools/lto/LTOCodeGenerator.h
index 4603c35..7b0c284 100644
--- a/tools/lto/LTOCodeGenerator.h
+++ b/tools/lto/LTOCodeGenerator.h
@@ -31,7 +31,7 @@
 public:
     static const char*        getVersionString();
     
-                            LTOCodeGenerator(const llvm::LLVMContext& Context);
+                            LTOCodeGenerator(llvm::LLVMContext& Context);
                             ~LTOCodeGenerator();
                             
     bool                addModule(class LTOModule*, std::string& errMsg);
@@ -54,7 +54,7 @@
     
     typedef llvm::StringMap<uint8_t> StringSet;
 
-    const llvm::LLVMContext&          _context;
+    llvm::LLVMContext&          _context;
     llvm::Linker                _linker;
     llvm::TargetMachine*        _target;
     bool                        _emitDwarfDebugInfo;
diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp
index 3da095d..157928c 100644
--- a/tools/lto/LTOModule.cpp
+++ b/tools/lto/LTOModule.cpp
@@ -87,7 +87,7 @@
 }
 
 LTOModule* LTOModule::makeLTOModule(const char* path,
-                                    const LLVMContext& Context,
+                                    LLVMContext& Context,
                                     std::string& errMsg)
 {
     OwningPtr<MemoryBuffer> buffer(MemoryBuffer::getFile(path, &errMsg));
@@ -113,7 +113,7 @@
 
 
 LTOModule* LTOModule::makeLTOModule(const void* mem, size_t length, 
-                                    const LLVMContext& Context,
+                                    LLVMContext& Context,
                                     std::string& errMsg)
 {
     OwningPtr<MemoryBuffer> buffer(makeBuffer(mem, length));
@@ -142,7 +142,7 @@
 }
 
 LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer,
-                                    const LLVMContext& Context,
+                                    LLVMContext& Context,
                                     std::string& errMsg)
 {
     // parse bitcode buffer
diff --git a/tools/lto/LTOModule.h b/tools/lto/LTOModule.h
index d7b992f..367ad10 100644
--- a/tools/lto/LTOModule.h
+++ b/tools/lto/LTOModule.h
@@ -52,10 +52,10 @@
                                                     const char* triplePrefix);
 
     static LTOModule*        makeLTOModule(const char* path,
-                                          const llvm::LLVMContext& Context,
+                                          llvm::LLVMContext& Context,
                                           std::string& errMsg);
     static LTOModule*        makeLTOModule(const void* mem, size_t length,
-                                           const llvm::LLVMContext& Context,
+                                           llvm::LLVMContext& Context,
                                            std::string& errMsg);
 
     const char*              getTargetTriple();
@@ -91,7 +91,7 @@
                                                     const char* triplePrefix);
 
     static LTOModule*       makeLTOModule(llvm::MemoryBuffer* buffer,
-                                          const llvm::LLVMContext& Context,
+                                          llvm::LLVMContext& Context,
                                                         std::string& errMsg);
     static llvm::MemoryBuffer* makeBuffer(const void* mem, size_t length);