summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/CodeGenInstruction.cpp
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2009-08-26 22:50:39 +0000
committerBob Wilson <bob.wilson@apple.com>2009-08-26 22:50:39 +0000
commit904d4c71d57160d1b52645a0d7101f2a45d98ce3 (patch)
tree57037ab39be6576d8458890cd69f1b582443391c /llvm/utils/TableGen/CodeGenInstruction.cpp
parent4d7b2e33072d4087f9966cac3dda0008df264a70 (diff)
downloadbcm5719-llvm-904d4c71d57160d1b52645a0d7101f2a45d98ce3.tar.gz
bcm5719-llvm-904d4c71d57160d1b52645a0d7101f2a45d98ce3.zip
Fix bad length argument to substr calls. Apparently I'm the first one to
attempt more than 2 constraints on an instruction. llvm-svn: 80169
Diffstat (limited to 'llvm/utils/TableGen/CodeGenInstruction.cpp')
-rw-r--r--llvm/utils/TableGen/CodeGenInstruction.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/CodeGenInstruction.cpp b/llvm/utils/TableGen/CodeGenInstruction.cpp
index 4650b88fd51..b7968a0e9cd 100644
--- a/llvm/utils/TableGen/CodeGenInstruction.cpp
+++ b/llvm/utils/TableGen/CodeGenInstruction.cpp
@@ -22,7 +22,7 @@ static void ParseConstraint(const std::string &CStr, CodeGenInstruction *I) {
std::string::size_type pos = CStr.find_first_of('=');
assert(pos != std::string::npos && "Unrecognized constraint");
std::string::size_type start = CStr.find_first_not_of(" \t");
- std::string Name = CStr.substr(start, pos);
+ std::string Name = CStr.substr(start, pos - start);
// TIED_TO: $src1 = $dst
std::string::size_type wpos = Name.find_first_of(" \t");
@@ -70,7 +70,7 @@ static void ParseConstraints(const std::string &CStr, CodeGenInstruction *I) {
if (eidx == std::string::npos)
eidx = CStr.length();
- ParseConstraint(CStr.substr(bidx, eidx), I);
+ ParseConstraint(CStr.substr(bidx, eidx - bidx), I);
bidx = CStr.find_first_not_of(delims, eidx);
}
}
OpenPOWER on IntegriCloud