From 97d939ee57f80d052d5b55dba51046f6aa459582 Mon Sep 17 00:00:00 2001 From: Rafael Stahl Date: Thu, 10 Jan 2019 17:44:04 +0000 Subject: [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 --- lib/CrossTU/CrossTranslationUnit.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/CrossTU/CrossTranslationUnit.cpp') 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> parseCrossTUIndex(StringRef IndexPath, StringRef CrossTUDir) { - std::ifstream ExternalFnMapFile(IndexPath); - if (!ExternalFnMapFile) + std::ifstream ExternalMapFile(IndexPath); + if (!ExternalMapFile) return llvm::make_error(index_error_code::missing_index_file, IndexPath.str()); llvm::StringMap 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( 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( 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: -- cgit v1.2.3