aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Frontend/CompilerInstance.h
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-02-19 21:39:31 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-02-19 21:39:31 +0000
commit96b1d4b4eb6b18dd6df7a2c0833332b45840580f (patch)
tree5c389038723168572e7e35c9f10d3460ad7354ca /include/clang/Frontend/CompilerInstance.h
parentb20f5c6f79968ce57ebb6222f0d2e7f51908d1be (diff)
Revert 125820 and 125819 to fix PR9266.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126050 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Frontend/CompilerInstance.h')
-rw-r--r--include/clang/Frontend/CompilerInstance.h21
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
/// {