[llvm-commits] [llvm] r52700 - /llvm/trunk/lib/VMCore/Constants.cpp

Owen Anderson resistor at mac.com
Tue Jun 24 18:05:06 PDT 2008


Author: resistor
Date: Tue Jun 24 20:05:05 2008
New Revision: 52700

URL: http://llvm.org/viewvc/llvm-project?rev=52700&view=rev
Log:
Use push_back rather than operator[], which is incorrect in this cases. Unfortunately, this slow the testcase down a little bit,
but only marginally.

Modified:
    llvm/trunk/lib/VMCore/Constants.cpp

Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=52700&r1=52699&r2=52700&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Tue Jun 24 20:05:05 2008
@@ -1380,7 +1380,7 @@
   std::string Result;
   Result.reserve(getNumOperands());
   for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
-    Result[i] = (char)cast<ConstantInt>(getOperand(i))->getZExtValue();
+    Result.push_back((char)cast<ConstantInt>(getOperand(i))->getZExtValue());
   return Result;
 }
 





More information about the llvm-commits mailing list