diff options
Diffstat (limited to 'include/clang/Frontend/CompilerInstance.h')
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index 7ea79e5599..430cc603c7 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -19,6 +19,7 @@ #include <string> namespace llvm { +class LLVMContext; class raw_ostream; class raw_fd_ostream; class Timer; @@ -58,6 +59,9 @@ 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; @@ -151,6 +155,23 @@ 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 /// { |