Assert instead of going into an infinite loop!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11946 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2004-02-28 16:31:53 +00:00
parent 6c39a42b5c
commit ff367ee1c5

View File

@@ -361,11 +361,14 @@ RecTy *VarInit::getFieldType(const std::string &FieldName) const {
Init *VarInit::getFieldInit(Record &R, const std::string &FieldName) const { Init *VarInit::getFieldInit(Record &R, const std::string &FieldName) const {
if (RecordRecTy *RTy = dynamic_cast<RecordRecTy*>(getType())) if (RecordRecTy *RTy = dynamic_cast<RecordRecTy*>(getType()))
if (const RecordVal *RV = R.getValue(VarName)) if (const RecordVal *RV = R.getValue(VarName)) {
if (Init *I = RV->getValue()->getFieldInit(R, FieldName)) Init *TheInit = RV->getValue();
assert(TheInit != this && "Infinite loop detected!");
if (Init *I = TheInit->getFieldInit(R, FieldName))
return I; return I;
else else
return 0; return 0;
}
return 0; return 0;
} }