[llvm-commits] [llvm] r133141 - /llvm/trunk/utils/TableGen/SetTheory.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Jun 15 19:55:57 PDT 2011


Author: stoklund
Date: Wed Jun 15 21:55:56 2011
New Revision: 133141

URL: http://llvm.org/viewvc/llvm-project?rev=133141&view=rev
Log:
Make sure to pass an unsigned to a printf format that is always %u.

This should unbreak the native ARM testers.

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

Modified: llvm/trunk/utils/TableGen/SetTheory.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SetTheory.cpp?rev=133141&r1=133140&r2=133141&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/SetTheory.cpp (original)
+++ llvm/trunk/utils/TableGen/SetTheory.cpp Wed Jun 15 21:55:56 2011
@@ -155,10 +155,15 @@
       From = II->getValue();
     else
       throw "From must be an integer: " + Expr->getAsString();
+    if (From < 0 || From >= UINT_MAX)
+      throw "From out of range";
+
     if (IntInit *II = dynamic_cast<IntInit*>(Expr->arg_begin()[2]))
       To = II->getValue();
     else
       throw "From must be an integer: " + Expr->getAsString();
+    if (To < 0 || To >= UINT_MAX)
+      throw "To out of range";
 
     RecordKeeper &Records =
       dynamic_cast<DefInit&>(*Expr->getOperator()).getDef()->getRecords();
@@ -167,7 +172,7 @@
     for (To += Step; From != To; From += Step) {
       std::string Name;
       raw_string_ostream OS(Name);
-      OS << format(Format.c_str(), From);
+      OS << format(Format.c_str(), unsigned(From));
       Record *Rec = Records.getDef(OS.str());
       if (!Rec)
         throw "No def named '" + Name + "': " + Expr->getAsString();





More information about the llvm-commits mailing list