From: Bill Wendling Date: Thu, 30 Aug 2012 00:34:21 +0000 (+0000) Subject: Revert r162855 in favor of changing clang to emit the absolute coverage file path. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=6e5190c193f6267893daf6943af88e95039e739c;p=oota-llvm.git Revert r162855 in favor of changing clang to emit the absolute coverage file path. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162883 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/lib/Transforms/Instrumentation/GCOVProfiling.cpp index f01c6d5a9e2..293bad32c82 100644 --- a/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -91,7 +91,7 @@ namespace { void insertCounterWriteout(ArrayRef >); void insertIndirectCounterIncrement(); - std::string mangleName(DICompileUnit CU, const char *NewStem); + std::string mangleName(DICompileUnit CU, std::string NewStem); bool EmitNotes; bool EmitData; @@ -328,10 +328,7 @@ namespace { }; } -std::string GCOVProfiler::mangleName(DICompileUnit CU, const char *NewStem) { - SmallString<128> Filename = CU.getFilename(); - bool AsString = false; - +std::string GCOVProfiler::mangleName(DICompileUnit CU, std::string NewStem) { if (NamedMDNode *GCov = M->getNamedMetadata("llvm.gcov")) { for (int i = 0, e = GCov->getNumOperands(); i != e; ++i) { MDNode *N = GCov->getOperand(i); @@ -340,25 +337,16 @@ std::string GCOVProfiler::mangleName(DICompileUnit CU, const char *NewStem) { MDNode *CompileUnit = dyn_cast(N->getOperand(1)); if (!GCovFile || !CompileUnit) continue; if (CompileUnit == CU) { - Filename = GCovFile->getString(); - AsString = true; - break; + SmallString<128> Filename = GCovFile->getString(); + sys::path::replace_extension(Filename, NewStem); + return Filename.str(); } } } - if (sys::path::is_relative(Filename.c_str())) { - SmallString<128> FullPath = CU.getDirectory(); - sys::path::append(FullPath, Filename.begin(), Filename.end()); - Filename = FullPath; - } - + SmallString<128> Filename = CU.getFilename(); sys::path::replace_extension(Filename, NewStem); - - if (!AsString) - return sys::path::filename(Filename.str()); - - return Filename.str(); + return sys::path::filename(Filename.str()); } bool GCOVProfiler::runOnModule(Module &M) {