aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Frontend/CompilerInstance.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Frontend/CompilerInstance.h')
-rw-r--r--include/clang/Frontend/CompilerInstance.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h
index b288236768..0cc1911c0c 100644
--- a/include/clang/Frontend/CompilerInstance.h
+++ b/include/clang/Frontend/CompilerInstance.h
@@ -19,6 +19,7 @@ class LLVMContext;
}
namespace clang {
+class ASTContext;
class Diagnostic;
class DiagnosticClient;
class Preprocessor;
@@ -70,6 +71,9 @@ class CompilerInstance {
/// The preprocessor.
llvm::OwningPtr<Preprocessor> PP;
+ /// The AST context.
+ llvm::OwningPtr<ASTContext> Context;
+
public:
/// Create a new compiler instance with the given LLVM context, optionally
/// taking ownership of it.
@@ -265,6 +269,23 @@ public:
void setPreprocessor(Preprocessor *Value) { PP.reset(Value); }
/// }
+ /// @name ASTContext
+ /// {
+
+ ASTContext &getASTContext() const {
+ assert(Context && "Compiler instance has no AST context!");
+ return *Context;
+ }
+
+ /// takeASTContext - Remove the current AST context and give ownership to the
+ /// caller.
+ ASTContext *takeASTContext() { return Context.take(); }
+
+ /// setASTContext - Replace the current AST context; the compiler instance
+ /// takes ownership of \arg Value.
+ void setASTContext(ASTContext *Value) { Context.reset(Value); }
+
+ /// }
/// @name Construction Utility Methods
/// {
@@ -280,6 +301,10 @@ public:
/// when the diagnostic options indicate that the compiler should output
/// logging information.
///
+ /// Note that this creates an unowned DiagnosticClient, if using directly the
+ /// caller is responsible for releaseing the returned Diagnostic's client
+ /// eventually.
+ ///
/// \return The new object on success, or null on failure.
static Diagnostic *createDiagnostics(const DiagnosticOptions &Opts,
int Argc, char **Argv);
@@ -307,6 +332,9 @@ public:
const TargetInfo &,
SourceManager &, FileManager &);
+ /// Create the AST context.
+ void createASTContext();
+
/// }
};