Browse code

bb #1879.

Port LLVM commit r98349:
Author: d0k
Date: Fri Mar 12 07:54:59 2010
New Revision: 98349

Log:
Use StringRef::substr instead of std::string::substr to avoid using a free'd
string temporary. This should fix PR6590.

Török Edvin authored on 2010/03/25 01:23:01
Showing 1 changed files
... ...
@@ -9851,7 +9851,8 @@ bool X86TargetLowering::ExpandInlineAsm(CallInst *CI) const {
9851 9851
         AsmPieces[2] == "${0:w}" &&
9852 9852
         IA->getConstraintString().compare(0, 5, "=r,0,") == 0) {
9853 9853
       AsmPieces.clear();
9854
-      SplitString(IA->getConstraintString().substr(5), AsmPieces, ",");
9854
+      const std::string &Constraints = IA->getConstraintString();
9855
+      SplitString(StringRef(Constraints).substr(5), AsmPieces, ",");
9855 9856
       std::sort(AsmPieces.begin(), AsmPieces.end());
9856 9857
       if (AsmPieces.size() == 4 &&
9857 9858
           AsmPieces[0] == "~{cc}" &&