diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-05-05 00:03:30 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-05-05 00:03:30 +0000 |
commit | a3d5d167a8cc7f0a4aa2156d2eeab6cb9bac3d4d (patch) | |
tree | 941f6f3eaf6616e8ebc3bb107ee30162a66ebded /llvm/lib/Transforms | |
parent | 1d3854d583d01d4dc9a445f5366d583a1924f1b3 (diff) | |
download | bcm5719-llvm-a3d5d167a8cc7f0a4aa2156d2eeab6cb9bac3d4d.tar.gz bcm5719-llvm-a3d5d167a8cc7f0a4aa2156d2eeab6cb9bac3d4d.zip |
When the path wasn't emitted by the frontend, discard any path on the source
filename.
llvm-svn: 130897
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 8dd82d3a9a9..629a485bc1c 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/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) { |