diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-08-12 23:31:19 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-08-12 23:31:19 +0000 |
commit | 0e93f017e5fecf01b207a60cc94964ffbe525348 (patch) | |
tree | 110aa1ea37cd07e6a678b128261a4dcabf2c240c /clang/lib/Frontend/CompilerInstance.cpp | |
parent | 384cae6e0652af7038515f9741f8bc710b12eb1c (diff) | |
download | bcm5719-llvm-0e93f017e5fecf01b207a60cc94964ffbe525348.tar.gz bcm5719-llvm-0e93f017e5fecf01b207a60cc94964ffbe525348.zip |
Teach CompilerInstance to create and hold on to the Sema object used
for parsing, so that it can persist beyond the lifetime of the parsing
call.
llvm-svn: 110978
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 76773e40d38..e2bb0f20db9 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "clang/Frontend/CompilerInstance.h" +#include "clang/Sema/Sema.h" #include "clang/AST/ASTConsumer.h" #include "clang/AST/ASTContext.h" #include "clang/Basic/Diagnostic.h" @@ -41,6 +42,7 @@ CompilerInstance::CompilerInstance() } CompilerInstance::~CompilerInstance() { + TheSema.reset(); } void CompilerInstance::setLLVMContext(llvm::LLVMContext *Value) { @@ -79,6 +81,10 @@ void CompilerInstance::setASTContext(ASTContext *Value) { Context.reset(Value); } +void CompilerInstance::setSema(Sema *S) { + TheSema.reset(S); +} + void CompilerInstance::setASTConsumer(ASTConsumer *Value) { Consumer.reset(Value); } @@ -362,6 +368,12 @@ CompilerInstance::createCodeCompletionConsumer(Preprocessor &PP, return new CIndexCodeCompleteConsumer(ShowMacros, ShowCodePatterns, OS); } +void CompilerInstance::createSema(bool CompleteTranslationUnit, + CodeCompleteConsumer *CompletionConsumer) { + TheSema.reset(new Sema(getPreprocessor(), getASTContext(), getASTConsumer(), + CompleteTranslationUnit, CompletionConsumer)); +} + // Output Files void CompilerInstance::addOutputFile(llvm::StringRef Path, |