diff options
author | Reid Kleckner <rnk@google.com> | 2019-10-28 14:40:17 -0700 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2019-10-28 14:40:17 -0700 |
commit | 7cd595df96d5929488063d8ff5cc3b5d800386da (patch) | |
tree | 21ca8a3fbbc70f8ed0d43ceee0fa9dd5d1150c70 /clang/lib/CodeGen | |
parent | de2c7cab715e195c9d559d317beb760cf0b95262 (diff) | |
download | bcm5719-llvm-7cd595df96d5929488063d8ff5cc3b5d800386da.tar.gz bcm5719-llvm-7cd595df96d5929488063d8ff5cc3b5d800386da.zip |
Revert "Use -fdebug-compilation-dir to form absolute paths in coverage mappings"
This reverts commit 9d4806a387892972fd544c0dcaefb0926126220c.
There seem to be bugs in llvm-cov --path-equivalence that are causing
Chromium problems. Revert this until they are understood or fixed.
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CoverageMappingGen.cpp | 25 | ||||
-rw-r--r-- | clang/lib/CodeGen/CoverageMappingGen.h | 8 |
2 files changed, 9 insertions, 24 deletions
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index a6f6e38d5f1..0a7a4fe33ac 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -1278,6 +1278,13 @@ std::string getCoverageSection(const CodeGenModule &CGM) { CGM.getContext().getTargetInfo().getTriple().getObjectFormat()); } +std::string normalizeFilename(StringRef Filename) { + llvm::SmallString<256> Path(Filename); + llvm::sys::fs::make_absolute(Path); + llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true); + return Path.str().str(); +} + } // end anonymous namespace static void dump(llvm::raw_ostream &OS, StringRef FunctionName, @@ -1310,24 +1317,6 @@ static void dump(llvm::raw_ostream &OS, StringRef FunctionName, } } -CoverageMappingModuleGen::CoverageMappingModuleGen( - CodeGenModule &CGM, CoverageSourceInfo &SourceInfo) - : CGM(CGM), SourceInfo(SourceInfo), FunctionRecordTy(nullptr) { - // Honor -fdebug-compilation-dir in paths in coverage data. Otherwise, use the - // regular working directory when normalizing paths. - if (!CGM.getCodeGenOpts().DebugCompilationDir.empty()) - CWD = CGM.getCodeGenOpts().DebugCompilationDir; - else - llvm::sys::fs::current_path(CWD); -} - -std::string CoverageMappingModuleGen::normalizeFilename(StringRef Filename) { - llvm::SmallString<256> Path(Filename); - llvm::sys::fs::make_absolute(CWD, Path); - llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true); - return Path.str().str(); -} - void CoverageMappingModuleGen::addFunctionMappingRecord( llvm::GlobalVariable *NamePtr, StringRef NameValue, uint64_t FuncHash, const std::string &CoverageMapping, bool IsUsed) { diff --git a/clang/lib/CodeGen/CoverageMappingGen.h b/clang/lib/CodeGen/CoverageMappingGen.h index 2bdc00e2566..3bf51f59047 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.h +++ b/clang/lib/CodeGen/CoverageMappingGen.h @@ -54,14 +54,10 @@ class CoverageMappingModuleGen { std::vector<llvm::Constant *> FunctionNames; llvm::StructType *FunctionRecordTy; std::vector<std::string> CoverageMappings; - SmallString<256> CWD; - - /// Make the filename absolute, remove dots, and normalize slashes to local - /// path style. - std::string normalizeFilename(StringRef Filename); public: - CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo); + CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo) + : CGM(CGM), SourceInfo(SourceInfo), FunctionRecordTy(nullptr) {} CoverageSourceInfo &getSourceInfo() const { return SourceInfo; |