[llvm-commits] [llvm] r162883 - /llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
Bill Wendling
isanbard at gmail.com
Wed Aug 29 17:34:21 PDT 2012
Author: void
Date: Wed Aug 29 19:34:21 2012
New Revision: 162883
URL: http://llvm.org/viewvc/llvm-project?rev=162883&view=rev
Log:
Revert r162855 in favor of changing clang to emit the absolute coverage file path.
Modified:
llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
Modified: llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp?rev=162883&r1=162882&r2=162883&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp Wed Aug 29 19:34:21 2012
@@ -91,7 +91,7 @@
void insertCounterWriteout(ArrayRef<std::pair<GlobalVariable*, MDNode*> >);
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 @@
};
}
-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 @@
MDNode *CompileUnit = dyn_cast<MDNode>(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) {
More information about the llvm-commits
mailing list