[llvm-commits] CVS: llvm/utils/TableGen/Record.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Aug 6 17:30:02 PDT 2003


Changes in directory llvm/utils/TableGen:

Record.cpp updated: 1.25 -> 1.26

---
Log message:

There is something wrong with code that looks like:
if (R == 0 || ...)
  R->getName()



---
Diffs of the changes:

Index: llvm/utils/TableGen/Record.cpp
diff -u llvm/utils/TableGen/Record.cpp:1.25 llvm/utils/TableGen/Record.cpp:1.26
--- llvm/utils/TableGen/Record.cpp:1.25	Mon Aug  4 15:44:17 2003
+++ llvm/utils/TableGen/Record.cpp	Wed Aug  6 17:29:04 2003
@@ -517,7 +517,7 @@
 Init *Record::getValueInit(const std::string &FieldName) const {
   const RecordVal *R = getValue(FieldName);
   if (R == 0 || R->getValue() == 0)
-    throw "Record '" + R->getName() + "' does not have a field named '" +
+    throw "Record '" + getName() + "' does not have a field named '" +
       FieldName + "!\n";
   return R->getValue();
 }
@@ -530,12 +530,12 @@
 std::string Record::getValueAsString(const std::string &FieldName) const {
   const RecordVal *R = getValue(FieldName);
   if (R == 0 || R->getValue() == 0)
-    throw "Record '" + R->getName() + "' does not have a field named '" +
+    throw "Record '" + getName() + "' does not have a field named '" +
           FieldName + "!\n";
 
   if (const StringInit *SI = dynamic_cast<const StringInit*>(R->getValue()))
     return SI->getValue();
-  throw "Record '" + R->getName() + "', field '" + FieldName +
+  throw "Record '" + getName() + "', field '" + FieldName +
         "' does not have a string initializer!";
 }
 
@@ -546,12 +546,12 @@
 BitsInit *Record::getValueAsBitsInit(const std::string &FieldName) const {
   const RecordVal *R = getValue(FieldName);
   if (R == 0 || R->getValue() == 0)
-    throw "Record '" + R->getName() + "' does not have a field named '" +
+    throw "Record '" + getName() + "' does not have a field named '" +
           FieldName + "!\n";
 
   if (BitsInit *BI = dynamic_cast<BitsInit*>(R->getValue()))
     return BI;
-  throw "Record '" + R->getName() + "', field '" + FieldName +
+  throw "Record '" + getName() + "', field '" + FieldName +
         "' does not have a BitsInit initializer!";
 }
 
@@ -562,12 +562,12 @@
 ListInit *Record::getValueAsListInit(const std::string &FieldName) const {
   const RecordVal *R = getValue(FieldName);
   if (R == 0 || R->getValue() == 0)
-    throw "Record '" + R->getName() + "' does not have a field named '" +
+    throw "Record '" + getName() + "' does not have a field named '" +
           FieldName + "!\n";
 
   if (ListInit *LI = dynamic_cast<ListInit*>(R->getValue()))
     return LI;
-  throw "Record '" + R->getName() + "', field '" + FieldName +
+  throw "Record '" + getName() + "', field '" + FieldName +
         "' does not have a list initializer!";
 }
 
@@ -578,12 +578,12 @@
 int Record::getValueAsInt(const std::string &FieldName) const {
   const RecordVal *R = getValue(FieldName);
   if (R == 0 || R->getValue() == 0)
-    throw "Record '" + R->getName() + "' does not have a field named '" +
+    throw "Record '" + getName() + "' does not have a field named '" +
           FieldName + "!\n";
 
   if (IntInit *II = dynamic_cast<IntInit*>(R->getValue()))
     return II->getValue();
-  throw "Record '" + R->getName() + "', field '" + FieldName +
+  throw "Record '" + getName() + "', field '" + FieldName +
         "' does not have a list initializer!";
 }
 
@@ -594,12 +594,12 @@
 Record *Record::getValueAsDef(const std::string &FieldName) const {
   const RecordVal *R = getValue(FieldName);
   if (R == 0 || R->getValue() == 0)
-    throw "Record '" + R->getName() + "' does not have a field named '" +
+    throw "Record '" + getName() + "' does not have a field named '" +
       FieldName + "!\n";
 
   if (DefInit *DI = dynamic_cast<DefInit*>(R->getValue()))
     return DI->getDef();
-  throw "Record '" + R->getName() + "', field '" + FieldName +
+  throw "Record '" + getName() + "', field '" + FieldName +
         "' does not have a list initializer!";
 }
 
@@ -610,12 +610,12 @@
 bool Record::getValueAsBit(const std::string &FieldName) const {
   const RecordVal *R = getValue(FieldName);
   if (R == 0 || R->getValue() == 0)
-    throw "Record '" + R->getName() + "' does not have a field named '" +
+    throw "Record '" + getName() + "' does not have a field named '" +
       FieldName + "!\n";
 
   if (BitInit *DI = dynamic_cast<BitInit*>(R->getValue()))
     return DI->getValue();
-  throw "Record '" + R->getName() + "', field '" + FieldName +
+  throw "Record '" + getName() + "', field '" + FieldName +
         "' does not have a list initializer!";
 }
 





More information about the llvm-commits mailing list