diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2016-11-16 18:15:26 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2016-11-16 18:15:26 +0000 |
commit | 7de9969bb0853f3331a29825ae5a959515d59d87 (patch) | |
tree | 2532c1bb348633d61d959ac9323d4034345d999a /clang/lib/Frontend/CompilerInstance.cpp | |
parent | 4ce99d4d240b2d7b400e7a8bb70d6c02e52ddb42 (diff) | |
download | bcm5719-llvm-7de9969bb0853f3331a29825ae5a959515d59d87.tar.gz bcm5719-llvm-7de9969bb0853f3331a29825ae5a959515d59d87.zip |
[Frontend] Allow attaching an external sema source to compiler instance and extra diags to TypoCorrections
This can be used to append alternative typo corrections to an existing diag.
include-fixer can use it to suggest includes to be added.
Differential Revision: https://reviews.llvm.org/D26745
llvm-svn: 287128
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index b2b7b7c67ba..b96dc70cf5b 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -538,6 +538,11 @@ void CompilerInstance::createSema(TranslationUnitKind TUKind, CodeCompleteConsumer *CompletionConsumer) { TheSema.reset(new Sema(getPreprocessor(), getASTContext(), getASTConsumer(), TUKind, CompletionConsumer)); + // Attach the external sema source if there is any. + if (ExternalSemaSrc) { + TheSema->addExternalSource(ExternalSemaSrc.get()); + ExternalSemaSrc->InitializeSema(*TheSema); + } } // Output Files @@ -1820,3 +1825,8 @@ CompilerInstance::lookupMissingImports(StringRef Name, return false; } void CompilerInstance::resetAndLeakSema() { BuryPointer(takeSema()); } + +void CompilerInstance::setExternalSemaSource( + IntrusiveRefCntPtr<ExternalSemaSource> ESS) { + ExternalSemaSrc = std::move(ESS); +} |