mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 13:11:39 +01:00
Make a std::string copy of StringRef Name so that it remains valid when the original Name is overridden.
Summary: lib/IR/AutoUpgrade.cpp:348 and lib/IR/AutoUpgrade.cpp:350 upset sanitizer. Reviewers: bkramer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D22140 llvm-svn: 274861
This commit is contained in:
parent
3eb1e8fba4
commit
7327cd030c
@ -67,7 +67,10 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
|
||||
assert(F && "Illegal to upgrade a non-existent Function.");
|
||||
|
||||
// Quickly eliminate it, if it's not a candidate.
|
||||
StringRef Name = F->getName();
|
||||
// Make a copy of the name so that we don't need to worry about the life-time
|
||||
// of StringRef.
|
||||
std::string NameStr = F->getName().str();
|
||||
StringRef Name = NameStr;
|
||||
if (Name.size() <= 8 || !Name.startswith("llvm."))
|
||||
return false;
|
||||
Name = Name.substr(5); // Strip off "llvm."
|
||||
|
Loading…
x
Reference in New Issue
Block a user