]> granicus.if.org Git - clang/commitdiff
Hold the LLVMContext by reference instead of by pointer.
authorOwen Anderson <resistor@mac.com>
Wed, 1 Jul 2009 21:23:16 +0000 (21:23 +0000)
committerOwen Anderson <resistor@mac.com>
Wed, 1 Jul 2009 21:23:16 +0000 (21:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74642 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/CodeGen/ModuleBuilder.h
include/clang/Frontend/ASTConsumers.h
lib/CodeGen/ModuleBuilder.cpp
lib/Frontend/Backend.cpp
tools/clang-cc/clang-cc.cpp

index f7e2480526d43580aa6f6247459e09eab83d9208..cf83aaf129559309120e7938b8f3a737387fb03e 100644 (file)
@@ -36,7 +36,7 @@ namespace clang {
   CodeGenerator *CreateLLVMCodeGen(Diagnostic &Diags,
                                    const std::string &ModuleName,
                                    const CompileOptions &CO,
-                                   llvm::LLVMContext* C);
+                                   const llvm::LLVMContext& C);
 }
 
 #endif
index b02548556d2058fd7c3e0e4c4dfe458120d950c4..35b00f1441854d08aebea6b18fa57074458d9b97 100644 (file)
@@ -81,7 +81,7 @@ ASTConsumer *CreateBackendConsumer(BackendAction Action,
                                    const CompileOptions &CompileOpts,
                                    const std::string &ModuleID,
                                    llvm::raw_ostream *OS,
-                                   llvm::LLVMContext* C);
+                                   const llvm::LLVMContext& C);
 
 // HTML printer: uses the rewriter to convert source code to HTML with
 // syntax highlighting suitable for viewing in a web-browser.
index 7937e9296747486e4bf30e4a9570cd6da53804a7..3faedc12bc731705a45e3a16ab8798574255ded0 100644 (file)
@@ -38,7 +38,7 @@ namespace {
     llvm::OwningPtr<CodeGen::CodeGenModule> Builder;
   public:
     CodeGeneratorImpl(Diagnostic &diags, const std::string& ModuleName,
-                      const CompileOptions &CO, llvm::LLVMContext* C)
+                      const CompileOptions &CO, const llvm::LLVMContext& C)
       : Diags(diags), CompileOpts(CO), M(new llvm::Module(ModuleName, C)) {}
     
     virtual ~CodeGeneratorImpl() {}
@@ -97,6 +97,6 @@ namespace {
 CodeGenerator *clang::CreateLLVMCodeGen(Diagnostic &Diags, 
                                         const std::string& ModuleName,
                                         const CompileOptions &CO,
-                                        llvm::LLVMContext* C) {
+                                        const llvm::LLVMContext& C) {
   return new CodeGeneratorImpl(Diags, ModuleName, CO, C);
 }
index dc84cd827136ae6e80651666a5f86b3b1613e0ae..6b7f9ae940cc23e572cfd871addc9a18a716bdc3 100644 (file)
@@ -76,7 +76,7 @@ namespace {
     BackendConsumer(BackendAction action, Diagnostic &Diags, 
                     const LangOptions &langopts, const CompileOptions &compopts,
                     const std::string &infile, llvm::raw_ostream* OS,
-                    LLVMContext* C) :
+                    const LLVMContext& C) :
       Action(action), 
       CompileOpts(compopts),
       AsmOutStream(OS), 
@@ -361,7 +361,7 @@ ASTConsumer *clang::CreateBackendConsumer(BackendAction Action,
                                           const CompileOptions &CompileOpts,
                                           const std::string& InFile,
                                           llvm::raw_ostream* OS,
-                                          LLVMContext* C) {
+                                          const LLVMContext& C) {
   return new BackendConsumer(Action, Diags, LangOpts, CompileOpts,
                              InFile, OS, C);
 }
index 69a540bd35b3a598fa7ec4f639f20ca9eb8c3207..341c10b9ad3ff04f0ffd8697e78ba4ee8e5e13a9 100644 (file)
@@ -1748,7 +1748,7 @@ static llvm::raw_ostream* ComputeOutFile(const std::string& InFile,
 static void ProcessInputFile(Preprocessor &PP, PreprocessorFactory &PPF,
                              const std::string &InFile, ProgActions PA,
                              const llvm::StringMap<bool> &Features,
-                             llvm::LLVMContext* Context) {
+                             const llvm::LLVMContext& Context) {
   llvm::OwningPtr<llvm::raw_ostream> OS;
   llvm::OwningPtr<ASTConsumer> Consumer;
   bool ClearSourceMgr = false;
@@ -2284,7 +2284,7 @@ int main(int argc, char **argv) {
       ((PathDiagnosticClient*)DiagClient.get())->SetPreprocessor(PP.get());
 
     // Process the source file.
-    ProcessInputFile(*PP, PPFactory, InFile, ProgAction, Features, &Context);
+    ProcessInputFile(*PP, PPFactory, InFile, ProgAction, Features, Context);
     
     HeaderInfo.ClearFileInfo();
     DiagClient->setLangOptions(0);