summaryrefslogtreecommitdiff
path: root/utils/TableGen/Record.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-28 16:31:53 +0000
committerChris Lattner <sabre@nondot.org>2004-02-28 16:31:53 +0000
commitff367ee1c5977299c57343f93a31c7d40b5ede5d (patch)
treed1da29626c18954da471991462b2e8d76a9d69de /utils/TableGen/Record.cpp
parent6c39a42b5c93b6d0af008dbafed6134d1deaa848 (diff)
downloadllvm-ff367ee1c5977299c57343f93a31c7d40b5ede5d.tar.gz
llvm-ff367ee1c5977299c57343f93a31c7d40b5ede5d.tar.bz2
llvm-ff367ee1c5977299c57343f93a31c7d40b5ede5d.tar.xz
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
Diffstat (limited to 'utils/TableGen/Record.cpp')
-rw-r--r--utils/TableGen/Record.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index 00751a1824..1a60ac489e 100644
--- a/utils/TableGen/Record.cpp
+++ b/utils/TableGen/Record.cpp
@@ -361,11 +361,14 @@ RecTy *VarInit::getFieldType(const std::string &FieldName) const {
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;
}