summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-10-29 12:49:37 +0000
committerDaniel Jasper <djasper@google.com>2015-10-29 12:49:37 +0000
commit1de905a667e662f2b25f865f84069020169b9275 (patch)
treeb9956497b1287daec44b029c6ed0bd64831d8889 /llvm/lib/Transforms
parent2f412684a943cb31197f940f0505f6edd67effe5 (diff)
downloadbcm5719-llvm-1de905a667e662f2b25f865f84069020169b9275.tar.gz
bcm5719-llvm-1de905a667e662f2b25f865f84069020169b9275.zip
Fix use-after-free. Thanks ASAN for giving me a detailed report :-).
llvm-svn: 251623
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/SampleProfile.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 47250cccc4d..51e95a5887a 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -380,9 +380,9 @@ bool SampleProfileLoader::computeBlockWeights(Function &F) {
if (SampleProfileCoverage) {
unsigned Coverage = CoverageTracker.computeCoverage(Samples);
if (Coverage < SampleProfileCoverage) {
- const char *Filename = getDISubprogram(&F)->getFilename().str().c_str();
+ StringRef Filename = getDISubprogram(&F)->getFilename();
F.getContext().diagnose(DiagnosticInfoSampleProfile(
- Filename, getFunctionLoc(F),
+ Filename.str().c_str(), getFunctionLoc(F),
Twine(CoverageTracker.getNumUsedSamples(Samples)) + " of " +
Twine(Samples->getBodySamples().size()) +
" available profile records (" + Twine(Coverage) +
OpenPOWER on IntegriCloud