[llvm-commits] CVS: llvm/utils/TableGen/FileLexer.l FileParser.y TableGen.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Feb 13 10:38:02 PST 2004


Changes in directory llvm/utils/TableGen:

FileLexer.l updated: 1.20 -> 1.21
FileParser.y updated: 1.26 -> 1.27
TableGen.cpp updated: 1.24 -> 1.25

---
Log message:

exit(1) instead of abort()'ing on error


---
Diffs of the changes:  (+27 -27)

Index: llvm/utils/TableGen/FileLexer.l
diff -u llvm/utils/TableGen/FileLexer.l:1.20 llvm/utils/TableGen/FileLexer.l:1.21
--- llvm/utils/TableGen/FileLexer.l:1.20	Fri Feb 13 10:33:56 2004
+++ llvm/utils/TableGen/FileLexer.l	Fri Feb 13 10:37:43 2004
@@ -130,7 +130,7 @@
     yyin = fopen(NextFilename.c_str(), "r");
     if (yyin == 0) {
       err() << "Could not find include file '" << Filename << "'!\n";
-      abort();
+      exit(1);
     }
     Filename = NextFilename;
   }
@@ -214,7 +214,7 @@
 <comment>"/*"           { ++CommentDepth; }
 <comment>"/"+[^*]*      /* eat up /'s not followed by *'s */
 <comment>"*"+"/"        { if (!--CommentDepth) { BEGIN(INITIAL); } }
-<comment><<EOF>>        { err() << "Unterminated comment!\n"; abort(); }
+<comment><<EOF>>        { err() << "Unterminated comment!\n"; exit(1); }
 
 .              { return Filetext[0]; }
 


Index: llvm/utils/TableGen/FileParser.y
diff -u llvm/utils/TableGen/FileParser.y:1.26 llvm/utils/TableGen/FileParser.y:1.27
--- llvm/utils/TableGen/FileParser.y:1.26	Tue Nov 11 16:41:34 2003
+++ llvm/utils/TableGen/FileParser.y	Fri Feb 13 10:37:43 2004
@@ -51,7 +51,7 @@
       err() << "New definition of '" << RV.getName() << "' of type '"
             << *RV.getType() << "' is incompatible with previous "
             << "definition of type '" << *ERV->getType() << "'!\n";
-      abort();
+      exit(1);
     }
   } else {
     CurRec->addValue(RV);
@@ -61,7 +61,7 @@
 static void addSuperClass(Record *SC) {
   if (CurRec->isSubClassOf(SC)) {
     err() << "Already subclass of '" << SC->getName() << "'!\n";
-    abort();
+    exit(1);
   }
   CurRec->addSuperClass(SC);
 }
@@ -73,7 +73,7 @@
   RecordVal *RV = CurRec->getValue(ValName);
   if (RV == 0) {
     err() << "Value '" << ValName << "' unknown!\n";
-    abort();
+    exit(1);
   }
   
   // If we are assigning to a subset of the bits in the value... then we must be
@@ -84,7 +84,7 @@
     BitsInit *CurVal = dynamic_cast<BitsInit*>(RV->getValue());
     if (CurVal == 0) {
       err() << "Value '" << ValName << "' is not a bits type!\n";
-      abort();
+      exit(1);
     }
 
     // Convert the incoming value to a bits type of the appropriate size...
@@ -92,7 +92,7 @@
     if (BI == 0) {
       V->convertInitializerTo(new BitsRecTy(BitList->size()));
       err() << "Initializer '" << *V << "' not compatible with bit range!\n";
-      abort();
+      exit(1);
     }
 
     // We should have a BitsInit type now...
@@ -107,7 +107,7 @@
       if (NewVal->getBit(Bit)) {
         err() << "Cannot set bit #" << Bit << " of value '" << ValName
               << "' more than once!\n";
-        abort();
+        exit(1);
       }
       NewVal->setBit(Bit, BInit->getBit(i));
     }
@@ -122,7 +122,7 @@
   if (RV->setValue(V)) {
     err() << "Value '" << ValName << "' of type '" << *RV->getType()
 	  << "' is incompatible with initializer '" << *V << "'!\n";
-    abort();
+    exit(1);
   }
 }
 
@@ -137,7 +137,7 @@
   // Ensure that an appropriate number of template arguments are specified...
   if (TArgs.size() < TemplateArgs.size()) {
     err() << "ERROR: More template args specified than expected!\n";
-    abort();
+    exit(1);
   } else {    // This class expects template arguments...
     // Loop over all of the template arguments, setting them to the specified
     // value or leaving them as the default as necessary.
@@ -149,7 +149,7 @@
 	err() << "ERROR: Value not specified for template argument #"
 	      << i << " (" << TArgs[i] << ") of subclass '" << SC->getName()
 	      << "'!\n";
-	abort();
+	exit(1);
       }
     }
   }
@@ -206,7 +206,7 @@
     $$ = Records.getClass(*$1);
     if ($$ == 0) {
       err() << "Couldn't find class '" << *$1 << "'!\n";
-      abort();
+      exit(1);
     }
     delete $1;
   };
@@ -252,7 +252,7 @@
       if (Bit == 0) {
 	err() << "Element #" << i << " (" << *(*$2)[i]
 	      << ") is not convertable to a bit!\n";
-	abort();
+	exit(1);
       }
       Init->setBit($2->size()-i-1, Bit);
     }
@@ -265,7 +265,7 @@
       $$ = new DefInit(D);
     } else {
       err() << "Variable not defined: '" << *$1 << "'!\n";
-      abort();
+      exit(1);
     }
     
     delete $1;
@@ -273,7 +273,7 @@
     $$ = $1->convertInitializerBitRange(*$3);
     if ($$ == 0) {
       err() << "Invalid bit range for value '" << *$1 << "'!\n";
-      abort();
+      exit(1);
     }
     delete $3;
   } | '[' ValueList ']' {
@@ -282,7 +282,7 @@
   } | Value '.' ID {
     if (!$1->getFieldType(*$3)) {
       err() << "Cannot access field '" << *$3 << "' of value '" << *$1 << "!\n";
-      abort();
+      exit(1);
     }
     $$ = new FieldInit($1, *$3);
     delete $3;
@@ -290,7 +290,7 @@
     Record *D = Records.getDef(*$2);
     if (D == 0) {
       err() << "Invalid def '" << *$2 << "'!\n";
-      abort();
+      exit(1);
     }
     $$ = new DagInit(D, *$3);
     delete $2; delete $3;
@@ -326,7 +326,7 @@
   } | INTVAL '-' INTVAL {
     if ($1 < $3 || $1 < 0 || $3 < 0) {
       err() << "Invalid bit range: " << $1 << "-" << $3 << "!\n";
-      abort();
+      exit(1);
     }
     $$ = new std::vector<unsigned>();
     for (int i = $1; i >= $3; --i)
@@ -335,7 +335,7 @@
     $2 = -$2;
     if ($1 < $2 || $1 < 0 || $2 < 0) {
       err() << "Invalid bit range: " << $1 << "-" << $2 << "!\n";
-      abort();
+      exit(1);
     }
     $$ = new std::vector<unsigned>();
     for (int i = $1; i >= $2; --i)
@@ -345,7 +345,7 @@
   } | RBitList ',' INTVAL '-' INTVAL {
     if ($3 < $5 || $3 < 0 || $5 < 0) {
       err() << "Invalid bit range: " << $3 << "-" << $5 << "!\n";
-      abort();
+      exit(1);
     }
     $$ = $1;
     for (int i = $3; i >= $5; --i)
@@ -354,7 +354,7 @@
     $4 = -$4;
     if ($3 < $4 || $3 < 0 || $4 < 0) {
       err() << "Invalid bit range: " << $3 << "-" << $4 << "!\n";
-      abort();
+      exit(1);
     }
     $$ = $1;
     for (int i = $3; i >= $4; --i)
@@ -472,7 +472,7 @@
 ClassInst : CLASS ObjectBody {
   if (Records.getClass($2->getName())) {
     err() << "Class '" << $2->getName() << "' already defined!\n";
-    abort();
+    exit(1);
   }
   Records.addClass($$ = $2);
 };
@@ -481,12 +481,12 @@
   if (!$2->getTemplateArgs().empty()) {
     err() << "Def '" << $2->getName()
           << "' is not permitted to have template arguments!\n";
-    abort();
+    exit(1);
   }
   // If ObjectBody has template arguments, it's an error.
   if (Records.getDef($2->getName())) {
     err() << "Def '" << $2->getName() << "' already defined!\n";
-    abort();
+    exit(1);
   }
   Records.addDef($$ = $2);
 };
@@ -520,5 +520,5 @@
 
 int yyerror(const char *ErrorMsg) {
   err() << "Error parsing: " << ErrorMsg << "\n";
-  abort();
+  exit(1);
 }


Index: llvm/utils/TableGen/TableGen.cpp
diff -u llvm/utils/TableGen/TableGen.cpp:1.24 llvm/utils/TableGen/TableGen.cpp:1.25
--- llvm/utils/TableGen/TableGen.cpp:1.24	Thu Feb  5 21:19:17 2004
+++ llvm/utils/TableGen/TableGen.cpp	Fri Feb 13 10:37:43 2004
@@ -97,7 +97,7 @@
     }
 
   std::cerr << "Cannot find requested bit!\n";
-  abort();
+  exit(1);
   return 0;
 }
 
@@ -273,7 +273,7 @@
     if (RangeBegin == InstsB && RangeEnd == InstsE) {
       std::cerr << "Error: Could not distinguish among the following insts!:\n";
       PrintRange(InstsB, InstsE);
-      abort();
+      exit(1);
     }
     
 #if 0





More information about the llvm-commits mailing list