X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2FTableGen%2FTGParser.cpp;h=1ea6b9816f6d34a3dac6451152a3ddb0939d6cf1;hb=249e1e4e2742977a4e3a5ba336b83168a4af43c0;hp=fdc162b4a44fd53c6facdc565be218e859db4c43;hpb=3060910e290949a9ac5eda8726d030790c4d60ff;p=oota-llvm.git diff --git a/utils/TableGen/TGParser.cpp b/utils/TableGen/TGParser.cpp index fdc162b4a44..1ea6b9816f6 100644 --- a/utils/TableGen/TGParser.cpp +++ b/utils/TableGen/TGParser.cpp @@ -124,7 +124,7 @@ bool TGParser::SetValue(Record *CurRec, LocTy Loc, const std::string &ValName, /// AddSubClass - Add SubClass as a subclass to CurRec, resolving its template /// args as SubClass's template arguments. -bool TGParser::AddSubClass(Record *CurRec, class SubClassReference &SubClass) { +bool TGParser::AddSubClass(Record *CurRec, SubClassReference &SubClass) { Record *SC = SubClass.Rec; // Add all of the values in the subclass into the current class. const std::vector &Vals = SC->getValues(); @@ -290,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"); @@ -423,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; @@ -613,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;