diff options
| author | Gabor Marton <martongabesz@gmail.com> | 2018-12-07 14:56:02 +0000 |
|---|---|---|
| committer | Gabor Marton <martongabesz@gmail.com> | 2018-12-07 14:56:02 +0000 |
| commit | 9419eb42c45be0e4f540bbcbb6bb93d8876559c6 (patch) | |
| tree | 1ca08a4773de8d99eea88c2caa4d5ea049f687c2 /clang/lib/CrossTU | |
| parent | b9e65cbddf6f5d7e387aae70a8db3e0ae55c0270 (diff) | |
| download | bcm5719-llvm-9419eb42c45be0e4f540bbcbb6bb93d8876559c6.tar.gz bcm5719-llvm-9419eb42c45be0e4f540bbcbb6bb93d8876559c6.zip | |
[CTU] Add DisplayCTUProgress analyzer switch
Summary:
With a new switch we may be able to print to stderr if a new TU is being loaded
during CTU. This is very important for higher level scripts (like CodeChecker)
to be able to parse this output so they can create e.g. a zip file in case of
a Clang crash which contains all the related TU files.
Reviewers: xazax.hun, Szelethus, a_sidorin, george.karpenkov
Subscribers: whisperity, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp,
Differential Revision: https://reviews.llvm.org/D55135
llvm-svn: 348594
Diffstat (limited to 'clang/lib/CrossTU')
| -rw-r--r-- | clang/lib/CrossTU/CrossTranslationUnit.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/CrossTU/CrossTranslationUnit.cpp b/clang/lib/CrossTU/CrossTranslationUnit.cpp index 97563b05b00..7d4f0ec9b42 100644 --- a/clang/lib/CrossTU/CrossTranslationUnit.cpp +++ b/clang/lib/CrossTU/CrossTranslationUnit.cpp @@ -159,7 +159,8 @@ CrossTranslationUnitContext::findFunctionInDeclContext(const DeclContext *DC, llvm::Expected<const FunctionDecl *> CrossTranslationUnitContext::getCrossTUDefinition(const FunctionDecl *FD, StringRef CrossTUDir, - StringRef IndexName) { + StringRef IndexName, + bool DisplayCTUProgress) { assert(FD && "FD is missing, bad call to this function!"); assert(!FD->hasBody() && "FD has a definition in current translation unit!"); ++NumGetCTUCalled; @@ -168,7 +169,7 @@ CrossTranslationUnitContext::getCrossTUDefinition(const FunctionDecl *FD, return llvm::make_error<IndexError>( index_error_code::failed_to_generate_usr); llvm::Expected<ASTUnit *> ASTUnitOrError = - loadExternalAST(LookupFnName, CrossTUDir, IndexName); + loadExternalAST(LookupFnName, CrossTUDir, IndexName, DisplayCTUProgress); if (!ASTUnitOrError) return ASTUnitOrError.takeError(); ASTUnit *Unit = *ASTUnitOrError; @@ -205,7 +206,8 @@ void CrossTranslationUnitContext::emitCrossTUDiagnostics(const IndexError &IE) { } llvm::Expected<ASTUnit *> CrossTranslationUnitContext::loadExternalAST( - StringRef LookupName, StringRef CrossTUDir, StringRef IndexName) { + StringRef LookupName, StringRef CrossTUDir, StringRef IndexName, + bool DisplayCTUProgress) { // FIXME: The current implementation only supports loading functions with // a lookup name from a single translation unit. If multiple // translation units contains functions with the same lookup name an @@ -247,6 +249,10 @@ llvm::Expected<ASTUnit *> CrossTranslationUnitContext::loadExternalAST( ASTUnit::LoadEverything, Diags, CI.getFileSystemOpts())); Unit = LoadedUnit.get(); FileASTUnitMap[ASTFileName] = std::move(LoadedUnit); + if (DisplayCTUProgress) { + llvm::errs() << "CTU loaded AST file: " + << ASTFileName << "\n"; + } } else { Unit = ASTCacheEntry->second.get(); } |

