aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
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
commit018cbd5ddf11a0bbab48cc2a374148bdfce9a9e2 (patch)
tree6b4654e47c29eb100660e0066df3e44f64d61b10 /lib/Target
parentbb2f0c541c1bcf05131b66e4aa036229fc5f068b (diff)
downloadexternal_llvm-018cbd5ddf11a0bbab48cc2a374148bdfce9a9e2.zip
external_llvm-018cbd5ddf11a0bbab48cc2a374148bdfce9a9e2.tar.gz
external_llvm-018cbd5ddf11a0bbab48cc2a374148bdfce9a9e2.tar.bz2
Use StringRef::substr instead of std::string::substr to avoid using a free'd
string temporary. This should fix PR6590. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98349 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/X86/X86ISelLowering.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
index fc30b13..8c09eec 100644
--- a/lib/Target/X86/X86ISelLowering.cpp
+++ b/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}" &&