Make sure to pass an unsigned to a printf format that is always %u.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 16 Jun 2011 02:55:56 +0000 (02:55 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 16 Jun 2011 02:55:56 +0000 (02:55 +0000)
This should unbreak the native ARM testers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133141 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/SetTheory.cpp

index ade182557678da15d336a33f99b21a340098a4cb..bee6763fb0560700babae7cef8a4e1b6d65de5ae 100644 (file)
@@ -155,10 +155,15 @@ struct SequenceOp : public SetTheory::Operator {
       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 @@ struct SequenceOp : public SetTheory::Operator {
     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();