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.

llvm-svn: 206032
This commit is contained in:
Diego Novillo 2014-04-11 13:55:56 +00:00
parent 77d8793fa6
commit 199de39bf0
2 changed files with 2 additions and 2 deletions

View File

@ -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 "<unknown>: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.

View File

@ -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("<unknown>");
unsigned Line = 0;
unsigned Column = 0;