[llvm-commits] [llvm] r80169 - /llvm/trunk/utils/TableGen/CodeGenInstruction.cpp

Bob Wilson bob.wilson at apple.com
Wed Aug 26 15:50:39 PDT 2009


Author: bwilson
Date: Wed Aug 26 17:50:39 2009
New Revision: 80169

URL: http://llvm.org/viewvc/llvm-project?rev=80169&view=rev
Log:
Fix bad length argument to substr calls.  Apparently I'm the first one to
attempt more than 2 constraints on an instruction.

Modified:
    llvm/trunk/utils/TableGen/CodeGenInstruction.cpp

Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.cpp?rev=80169&r1=80168&r2=80169&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenInstruction.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenInstruction.cpp Wed Aug 26 17:50:39 2009
@@ -22,7 +22,7 @@
   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 @@
     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);
   }
 }





More information about the llvm-commits mailing list