From bb7b423bdc5cf85f4b68afdd8665e4848d2845d1 Mon Sep 17 00:00:00 2001 From: Diego Novillo Date: Fri, 11 Apr 2014 13:55:56 +0000 Subject: [PATCH] Fix use-after-free bug caught by address sanitizer: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/2959 The location string is returned as a std::string, not a StringRef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206032 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/DiagnosticInfo.h | 2 +- lib/IR/DiagnosticInfo.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/llvm/IR/DiagnosticInfo.h b/include/llvm/IR/DiagnosticInfo.h index fb3c9b6302d..8e6f949b2f3 100644 --- a/include/llvm/IR/DiagnosticInfo.h +++ b/include/llvm/IR/DiagnosticInfo.h @@ -267,7 +267,7 @@ public: /// Return a string with the location information for this diagnostic /// in the format "file:line:col". If location information is not available, /// it returns ":0:0". - const StringRef getLocationStr() const; + const std::string getLocationStr() const; /// Return location information for this diagnostic in three parts: /// the source file name, line number and column. diff --git a/lib/IR/DiagnosticInfo.cpp b/lib/IR/DiagnosticInfo.cpp index 82cc0ed47b7..3f8100f985d 100644 --- a/lib/IR/DiagnosticInfo.cpp +++ b/lib/IR/DiagnosticInfo.cpp @@ -80,7 +80,7 @@ void DiagnosticInfoOptimizationRemark::getLocation(StringRef *Filename, *Column = DIL.getColumnNumber(); } -const StringRef DiagnosticInfoOptimizationRemark::getLocationStr() const { +const std::string DiagnosticInfoOptimizationRemark::getLocationStr() const { StringRef Filename(""); unsigned Line = 0; unsigned Column = 0; -- 2.34.1