diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-11-13 08:20:47 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-11-13 08:20:47 +0000 |
commit | 5eb810024dc8a1d12d5f066c02c978f07c4fcb00 (patch) | |
tree | 2ed8a314e87a0e312408af4deef30d973abae917 /include/clang/Frontend/CompilerInstance.h | |
parent | fc7ac8f0b9ffd83b9e7329926e9e184586b49138 (diff) |
Add ASTContext to CompilerInstance.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@87095 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Frontend/CompilerInstance.h')
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 28 |
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(); + /// } }; |