Forgot to check that debug information is supported.
[oota-llvm.git] / utils / TableGen / TGParser.cpp
index fdc162b4a44fd53c6facdc565be218e859db4c43..1ea6b9816f6d34a3dac6451152a3ddb0939d6cf1 100644 (file)
@@ -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<RecordVal> &Vals = SC->getValues();
@@ -290,9 +290,12 @@ ParseSubClassReference(Record *CurRec, bool isDefm) {
 ///   RangePiece ::= INTVAL '-' INTVAL
 ///   RangePiece ::= INTVAL INTVAL
 bool TGParser::ParseRangePiece(std::vector<unsigned> &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<n> 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<n> 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;