summaryrefslogtreecommitdiffstats
path: root/utils/TableGen/SetTheory.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2011-07-17 15:36:56 +0000
committerdim <dim@FreeBSD.org>2011-07-17 15:36:56 +0000
commit1176aa52646fe641a4243a246aa7f960c708a274 (patch)
treec8086addb211fa670a9d2b1038d8c2e453229755 /utils/TableGen/SetTheory.cpp
parentece02cd5829cea836e9365b0845a8ef042d17b0a (diff)
downloadFreeBSD-src-1176aa52646fe641a4243a246aa7f960c708a274.zip
FreeBSD-src-1176aa52646fe641a4243a246aa7f960c708a274.tar.gz
Vendor import of llvm trunk r135360:
http://llvm.org/svn/llvm-project/llvm/trunk@135360
Diffstat (limited to 'utils/TableGen/SetTheory.cpp')
-rw-r--r--utils/TableGen/SetTheory.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/utils/TableGen/SetTheory.cpp b/utils/TableGen/SetTheory.cpp
index ade1825..21ac09c 100644
--- a/utils/TableGen/SetTheory.cpp
+++ b/utils/TableGen/SetTheory.cpp
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "SetTheory.h"
+#include "Error.h"
#include "Record.h"
#include "llvm/Support/Format.h"
@@ -155,10 +156,15 @@ struct SequenceOp : public SetTheory::Operator {
From = II->getValue();
else
throw "From must be an integer: " + Expr->getAsString();
+ if (From < 0 || From >= (1 << 30))
+ 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 >= (1 << 30))
+ throw "To out of range";
RecordKeeper &Records =
dynamic_cast<DefInit&>(*Expr->getOperator()).getDef()->getRecords();
@@ -167,7 +173,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();
OpenPOWER on IntegriCloud