diff options
author | Kadir Cetinkaya <kadircet@google.com> | 2019-10-10 12:20:11 +0000 |
---|---|---|
committer | Kadir Cetinkaya <kadircet@google.com> | 2019-10-10 12:20:11 +0000 |
commit | 62808631acceaa8b78f8ab9b407eb6b943ff5f77 (patch) | |
tree | 7ed3f9665369500ddef322402f52cefe547334d8 /clang/lib/CodeGen/CoverageMappingGen.cpp | |
parent | 44506cd7f2b0758d37611d405beb6eb1f6f90f17 (diff) | |
download | bcm5719-llvm-62808631acceaa8b78f8ab9b407eb6b943ff5f77.tar.gz bcm5719-llvm-62808631acceaa8b78f8ab9b407eb6b943ff5f77.zip |
Revert "Use -fdebug-compilation-dir to form absolute paths in coverage mappings"
This reverts commit f6777964bde28c349d3e289ea37ecf5f5eeedbc4.
Because the absolute path check relies on temporary path containing
"clang", "test" and "CoverageMapping" as a subsequence, which is not
necessarily true on all systems(breaks internal integrates). Wanted to
fix it by checking for a leading "/" instead, but then noticed that it
would break windows tests, so leaving it to the author instead.
llvm-svn: 374324
Diffstat (limited to 'clang/lib/CodeGen/CoverageMappingGen.cpp')
-rw-r--r-- | clang/lib/CodeGen/CoverageMappingGen.cpp | 25 |
1 files changed, 7 insertions, 18 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) { |