summaryrefslogtreecommitdiffstats
path: root/clang/include
diff options
context:
space:
mode:
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang/CodeGen/CodeGenAction.h23
-rw-r--r--clang/include/clang/Frontend/ASTConsumers.h2
-rw-r--r--clang/include/clang/Frontend/CompilerInstance.h21
3 files changed, 16 insertions, 30 deletions
diff --git a/clang/include/clang/CodeGen/CodeGenAction.h b/clang/include/clang/CodeGen/CodeGenAction.h
index b55effc6be0..052c6603f5a 100644
--- a/clang/include/clang/CodeGen/CodeGenAction.h
+++ b/clang/include/clang/CodeGen/CodeGenAction.h
@@ -14,6 +14,7 @@
#include "llvm/ADT/OwningPtr.h"
namespace llvm {
+ class LLVMContext;
class Module;
}
@@ -24,9 +25,14 @@ class CodeGenAction : public ASTFrontendAction {
private:
unsigned Act;
llvm::OwningPtr<llvm::Module> TheModule;
+ llvm::LLVMContext *VMContext;
+ bool OwnsVMContext;
protected:
- CodeGenAction(unsigned _Act);
+ /// Create a new code generation action. If the optional \arg _VMContext
+ /// parameter is supplied, the action uses it without taking ownership,
+ /// otherwise it creates a fresh LLVM context and takes ownership.
+ CodeGenAction(unsigned _Act, llvm::LLVMContext *_VMContext = 0);
virtual bool hasIRSupport() const;
@@ -44,37 +50,40 @@ public:
/// been run. The result may be null on failure.
llvm::Module *takeModule();
+ /// Take the LLVM context used by this action.
+ llvm::LLVMContext *takeLLVMContext();
+
BackendConsumer *BEConsumer;
};
class EmitAssemblyAction : public CodeGenAction {
public:
- EmitAssemblyAction();
+ EmitAssemblyAction(llvm::LLVMContext *_VMContext = 0);
};
class EmitBCAction : public CodeGenAction {
public:
- EmitBCAction();
+ EmitBCAction(llvm::LLVMContext *_VMContext = 0);
};
class EmitLLVMAction : public CodeGenAction {
public:
- EmitLLVMAction();
+ EmitLLVMAction(llvm::LLVMContext *_VMContext = 0);
};
class EmitLLVMOnlyAction : public CodeGenAction {
public:
- EmitLLVMOnlyAction();
+ EmitLLVMOnlyAction(llvm::LLVMContext *_VMContext = 0);
};
class EmitCodeGenOnlyAction : public CodeGenAction {
public:
- EmitCodeGenOnlyAction();
+ EmitCodeGenOnlyAction(llvm::LLVMContext *_VMContext = 0);
};
class EmitObjAction : public CodeGenAction {
public:
- EmitObjAction();
+ EmitObjAction(llvm::LLVMContext *_VMContext = 0);
};
}
diff --git a/clang/include/clang/Frontend/ASTConsumers.h b/clang/include/clang/Frontend/ASTConsumers.h
index e2071df8e32..c45bd407060 100644
--- a/clang/include/clang/Frontend/ASTConsumers.h
+++ b/clang/include/clang/Frontend/ASTConsumers.h
@@ -18,8 +18,6 @@
namespace llvm {
class raw_ostream;
- class Module;
- class LLVMContext;
namespace sys { class Path; }
}
namespace clang {
diff --git a/clang/include/clang/Frontend/CompilerInstance.h b/clang/include/clang/Frontend/CompilerInstance.h
index 430cc603c78..7ea79e5599f 100644
--- a/clang/include/clang/Frontend/CompilerInstance.h
+++ b/clang/include/clang/Frontend/CompilerInstance.h
@@ -19,7 +19,6 @@
#include <string>
namespace llvm {
-class LLVMContext;
class raw_ostream;
class raw_fd_ostream;
class Timer;
@@ -59,9 +58,6 @@ class TargetInfo;
/// come in two forms; a short form that reuses the CompilerInstance objects,
/// and a long form that takes explicit instances of any required objects.
class CompilerInstance {
- /// The LLVM context used for this instance.
- llvm::OwningPtr<llvm::LLVMContext> LLVMContext;
-
/// The options used in this compiler instance.
llvm::OwningPtr<CompilerInvocation> Invocation;
@@ -155,23 +151,6 @@ public:
bool ExecuteAction(FrontendAction &Act);
/// }
- /// @name LLVM Context
- /// {
-
- bool hasLLVMContext() const { return LLVMContext != 0; }
-
- llvm::LLVMContext &getLLVMContext() const {
- assert(LLVMContext && "Compiler instance has no LLVM context!");
- return *LLVMContext;
- }
-
- llvm::LLVMContext *takeLLVMContext() { return LLVMContext.take(); }
-
- /// setLLVMContext - Replace the current LLVM context and take ownership of
- /// \arg Value.
- void setLLVMContext(llvm::LLVMContext *Value);
-
- /// }
/// @name Compiler Invocation and Options
/// {
OpenPOWER on IntegriCloud