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

Chris Lattner lattner at cs.uiuc.edu
Sat Feb 28 10:33:01 PST 2004


Changes in directory llvm/utils/TableGen:

Record.cpp updated: 1.30 -> 1.31

---
Log message:

Assert instead of going into an infinite loop!


---
Diffs of the changes:  (+5 -2)

Index: llvm/utils/TableGen/Record.cpp
diff -u llvm/utils/TableGen/Record.cpp:1.30 llvm/utils/TableGen/Record.cpp:1.31
--- llvm/utils/TableGen/Record.cpp:1.30	Tue Nov 11 16:41:34 2003
+++ llvm/utils/TableGen/Record.cpp	Sat Feb 28 10:31:53 2004
@@ -361,11 +361,14 @@
 
 Init *VarInit::getFieldInit(Record &R, const std::string &FieldName) const {
   if (RecordRecTy *RTy = dynamic_cast<RecordRecTy*>(getType()))
-    if (const RecordVal *RV = R.getValue(VarName))
-      if (Init *I = RV->getValue()->getFieldInit(R, FieldName))
+    if (const RecordVal *RV = R.getValue(VarName)) {
+      Init *TheInit = RV->getValue();
+      assert(TheInit != this && "Infinite loop detected!");
+      if (Init *I = TheInit->getFieldInit(R, FieldName))
         return I;
       else
         return 0;
+    }
   return 0;
 }
 





More information about the llvm-commits mailing list