summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-05-05 00:03:30 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-05-05 00:03:30 +0000
commitfcf74ed5a2bc10570dec2084a2db1f6580b1210d (patch)
treefa1760e00c6deed4e74b52cc7269d1758a6b4080
parent7a2718a3c185dc4b52d04ac701a0abe173b2e273 (diff)
downloadexternal_llvm-fcf74ed5a2bc10570dec2084a2db1f6580b1210d.zip
external_llvm-fcf74ed5a2bc10570dec2084a2db1f6580b1210d.tar.gz
external_llvm-fcf74ed5a2bc10570dec2084a2db1f6580b1210d.tar.bz2
When the path wasn't emitted by the frontend, discard any path on the source
filename. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130897 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Instrumentation/GCOVProfiling.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/lib/Transforms/Instrumentation/GCOVProfiling.cpp
index 8dd82d3..629a485 100644
--- a/lib/Transforms/Instrumentation/GCOVProfiling.cpp
+++ b/lib/Transforms/Instrumentation/GCOVProfiling.cpp
@@ -331,15 +331,20 @@ std::string GCOVProfiler::mangleName(DICompileUnit CU, std::string NewStem) {
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) {