diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-06-16 02:55:56 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-06-16 02:55:56 +0000 |
commit | e3ebb40ff1d16bc3167acd1d81815a2e13afc32d (patch) | |
tree | eb997d40426151b4e896e56ce8d7b988f48b4718 /llvm/utils/TableGen/SetTheory.cpp | |
parent | bdf3ca918683e2aa68295b06db7f32f438e8ecfa (diff) | |
download | bcm5719-llvm-e3ebb40ff1d16bc3167acd1d81815a2e13afc32d.tar.gz bcm5719-llvm-e3ebb40ff1d16bc3167acd1d81815a2e13afc32d.zip |
Make sure to pass an unsigned to a printf format that is always %u.
This should unbreak the native ARM testers.
llvm-svn: 133141
Diffstat (limited to 'llvm/utils/TableGen/SetTheory.cpp')
-rw-r--r-- | llvm/utils/TableGen/SetTheory.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/SetTheory.cpp b/llvm/utils/TableGen/SetTheory.cpp index ade18255767..bee6763fb05 100644 --- a/llvm/utils/TableGen/SetTheory.cpp +++ b/llvm/utils/TableGen/SetTheory.cpp @@ -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(); |