diff options
author | Rafael Stahl <r.stahl@tum.de> | 2019-01-10 17:44:04 +0000 |
---|---|---|
committer | Rafael Stahl <r.stahl@tum.de> | 2019-01-10 17:44:04 +0000 |
commit | 97d939ee57f80d052d5b55dba51046f6aa459582 (patch) | |
tree | 6be35183dbf4952539cdf0cb5fe4903f6e9db423 /lib/CrossTU/CrossTranslationUnit.cpp | |
parent | c2686e43c2fcd01692c0f465d6ffc741afd7d939 (diff) |
[analyzer][CrossTU][NFC] Generalize to external definitions instead of external functions
Summary: This is just changing naming and documentation to be general about external definitions that can be imported for cross translation unit analysis. There is at least a plan to add VarDecls: D46421
Reviewers: NoQ, xazax.hun, martong, a.sidorin, george.karpenkov, serge-sans-paille
Reviewed By: xazax.hun, martong
Subscribers: mgorny, whisperity, baloghadamsoftware, szepet, rnkovacs, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits
Differential Revision: https://reviews.llvm.org/D56441
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350852 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CrossTU/CrossTranslationUnit.cpp')
-rw-r--r-- | lib/CrossTU/CrossTranslationUnit.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/CrossTU/CrossTranslationUnit.cpp b/lib/CrossTU/CrossTranslationUnit.cpp index 915b5246c9..7c97beb498 100644 --- a/lib/CrossTU/CrossTranslationUnit.cpp +++ b/lib/CrossTU/CrossTranslationUnit.cpp @@ -120,26 +120,26 @@ std::error_code IndexError::convertToErrorCode() const { llvm::Expected<llvm::StringMap<std::string>> parseCrossTUIndex(StringRef IndexPath, StringRef CrossTUDir) { - std::ifstream ExternalFnMapFile(IndexPath); - if (!ExternalFnMapFile) + std::ifstream ExternalMapFile(IndexPath); + if (!ExternalMapFile) return llvm::make_error<IndexError>(index_error_code::missing_index_file, IndexPath.str()); llvm::StringMap<std::string> Result; std::string Line; unsigned LineNo = 1; - while (std::getline(ExternalFnMapFile, Line)) { + while (std::getline(ExternalMapFile, Line)) { const size_t Pos = Line.find(" "); if (Pos > 0 && Pos != std::string::npos) { StringRef LineRef{Line}; - StringRef FunctionLookupName = LineRef.substr(0, Pos); - if (Result.count(FunctionLookupName)) + StringRef LookupName = LineRef.substr(0, Pos); + if (Result.count(LookupName)) return llvm::make_error<IndexError>( index_error_code::multiple_definitions, IndexPath.str(), LineNo); StringRef FileName = LineRef.substr(Pos + 1); SmallString<256> FilePath = CrossTUDir; llvm::sys::path::append(FilePath, FileName); - Result[FunctionLookupName] = FilePath.str().str(); + Result[LookupName] = FilePath.str().str(); } else return llvm::make_error<IndexError>( index_error_code::invalid_index_format, IndexPath.str(), LineNo); @@ -250,7 +250,7 @@ void CrossTranslationUnitContext::emitCrossTUDiagnostics(const IndexError &IE) { << IE.getFileName(); break; case index_error_code::invalid_index_format: - Context.getDiagnostics().Report(diag::err_fnmap_parsing) + Context.getDiagnostics().Report(diag::err_extdefmap_parsing) << IE.getFileName() << IE.getLineNum(); break; case index_error_code::multiple_definitions: |