summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-03-12 13:54:59 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-03-12 13:54:59 +0000
commitd69ee90f2f07bb5846ab7081a2ff2065dc15b895 (patch)
tree393d488c3af2886c116d507e8d7518038d2c831d
parent607f1825b0f6fb952e7eb8356a5dbfe7da1a3c1c (diff)
downloadbcm5719-llvm-d69ee90f2f07bb5846ab7081a2ff2065dc15b895.tar.gz
bcm5719-llvm-d69ee90f2f07bb5846ab7081a2ff2065dc15b895.zip
Use StringRef::substr instead of std::string::substr to avoid using a free'd
string temporary. This should fix PR6590. llvm-svn: 98349
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index fc30b134e01..8c09eecd4f6 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -9837,7 +9837,8 @@ bool X86TargetLowering::ExpandInlineAsm(CallInst *CI) const {
AsmPieces[2] == "${0:w}" &&
IA->getConstraintString().compare(0, 5, "=r,0,") == 0) {
AsmPieces.clear();
- SplitString(IA->getConstraintString().substr(5), AsmPieces, ",");
+ const std::string &Constraints = IA->getConstraintString();
+ SplitString(StringRef(Constraints).substr(5), AsmPieces, ",");
std::sort(AsmPieces.begin(), AsmPieces.end());
if (AsmPieces.size() == 4 &&
AsmPieces[0] == "~{cc}" &&
OpenPOWER on IntegriCloud