[llvm-commits] [llvm] r130897 - /llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
Nick Lewycky
nicholas at mxc.ca
Wed May 4 17:03:30 PDT 2011
Author: nicholas
Date: Wed May 4 19:03:30 2011
New Revision: 130897
URL: http://llvm.org/viewvc/llvm-project?rev=130897&view=rev
Log:
When the path wasn't emitted by the frontend, discard any path on the source
filename.
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=130897&r1=130896&r2=130897&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp Wed May 4 19:03:30 2011
@@ -331,15 +331,20 @@
for (int i = 0, e = GCov->getNumOperands(); i != e; ++i) {
MDNode *N = GCov->getOperand(i);
if (N->getNumOperands() != 2) continue;
- MDString *Path = dyn_cast<MDString>(N->getOperand(0));
+ MDString *GCovFile = dyn_cast<MDString>(N->getOperand(0));
MDNode *CompileUnit = dyn_cast<MDNode>(N->getOperand(1));
- if (!Path || !CompileUnit) continue;
- if (CompileUnit == CU)
- return (Path->getString() + "/" +
- replaceStem(CU.getFilename(), NewStem)).str();
+ if (!GCovFile || !CompileUnit) continue;
+ if (CompileUnit == CU) {
+ SmallString<128> Filename = GCovFile->getString();
+ sys::path::replace_extension(Filename, NewStem);
+ return Filename.str();
+ }
}
}
- return replaceStem(CU.getFilename(), NewStem);
+
+ SmallString<128> Filename = CU.getFilename();
+ sys::path::replace_extension(Filename, NewStem);
+ return sys::path::filename(Filename.str());
}
bool GCOVProfiler::runOnModule(Module &M) {
More information about the llvm-commits
mailing list