X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2FTableGen%2FTGParser.cpp;h=4ff108d2603a40ffc8f9e78b279b72b54e6d5c91;hb=b2a14325079f64debd7df6d5a8ed2037b3128154;hp=2f0533a18dbfce308c97ae9edc076477b7685c1e;hpb=5d814864133fd3be4414a043341508bcc2caa7b5;p=oota-llvm.git diff --git a/utils/TableGen/TGParser.cpp b/utils/TableGen/TGParser.cpp index 2f0533a18db..4ff108d2603 100644 --- a/utils/TableGen/TGParser.cpp +++ b/utils/TableGen/TGParser.cpp @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by Chris Lattner and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // @@ -11,6 +11,8 @@ // //===----------------------------------------------------------------------===// +#include + #include "TGParser.h" #include "Record.h" #include "llvm/ADT/StringExtras.h" @@ -288,9 +290,12 @@ ParseSubClassReference(Record *CurRec, bool isDefm) { /// RangePiece ::= INTVAL '-' INTVAL /// RangePiece ::= INTVAL INTVAL bool TGParser::ParseRangePiece(std::vector &Ranges) { - assert(Lex.getCode() == tgtok::IntVal && "Invalid range"); - int Start = Lex.getCurIntVal(); - int End; + if (Lex.getCode() != tgtok::IntVal) { + TokError("expected integer or bitrange"); + return true; + } + int64_t Start = Lex.getCurIntVal(); + int64_t End; if (Start < 0) return TokError("invalid range, cannot be negative"); @@ -421,7 +426,7 @@ RecTy *TGParser::ParseType() { TokError("expected integer in bits type"); return 0; } - unsigned Val = Lex.getCurIntVal(); + uint64_t Val = Lex.getCurIntVal(); if (Lex.Lex() != tgtok::greater) { // Eat count. TokError("expected '>' at end of bits type"); return 0; @@ -611,6 +616,11 @@ Init *TGParser::ParseSimpleValue(Record *CurRec) { } case tgtok::l_paren: { // Value ::= '(' IDValue DagArgList ')' Lex.Lex(); // eat the '(' + if (Lex.getCode() != tgtok::Id) { + TokError("expected identifier in dag init"); + return 0; + } + Init *Operator = ParseIDValue(CurRec); if (Operator == 0) return 0;