diff options
Diffstat (limited to 'include/clang/Frontend/CompilerInstance.h')
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index ee0c3c02f2..5e347061cc 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -25,6 +25,7 @@ class raw_fd_ostream; namespace clang { class ASTContext; +class ASTConsumer; class CodeCompleteConsumer; class Diagnostic; class DiagnosticClient; @@ -82,6 +83,9 @@ class CompilerInstance { /// The AST context. llvm::OwningPtr<ASTContext> Context; + /// The AST consumer. + llvm::OwningPtr<ASTConsumer> Consumer; + /// The code completion consumer. llvm::OwningPtr<CodeCompleteConsumer> CompletionConsumer; @@ -312,6 +316,25 @@ public: void setASTContext(ASTContext *Value); /// } + /// @name ASTConsumer + /// { + + bool hasASTConsumer() const { return Consumer != 0; } + + ASTConsumer &getASTConsumer() const { + assert(Consumer && "Compiler instance has no AST consumer!"); + return *Consumer; + } + + /// takeASTConsumer - Remove the current AST consumer and give ownership to + /// the caller. + ASTConsumer *takeASTConsumer() { return Consumer.take(); } + + /// setASTConsumer - Replace the current AST consumer; the compiler instance + /// takes ownership of \arg Value. + void setASTConsumer(ASTConsumer *Value); + + /// } /// @name Code Completion /// { |