diff options
author | David Greene <greened@obbligato.org> | 2009-05-14 20:38:52 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2009-05-14 20:38:52 +0000 |
commit | d4b7802fcb6497ffa5f04d53f09e1b0a8ef629b6 (patch) | |
tree | 6f4758641d0f2ef4ac2dbefc34311bbecf031e21 /utils | |
parent | f60642422fcb0e79d00f323b8f649f17de36cf91 (diff) | |
download | external_llvm-d4b7802fcb6497ffa5f04d53f09e1b0a8ef629b6.zip external_llvm-d4b7802fcb6497ffa5f04d53f09e1b0a8ef629b6.tar.gz external_llvm-d4b7802fcb6497ffa5f04d53f09e1b0a8ef629b6.tar.bz2 |
Fix PR4207.
If we're resolving a list element access and we're given a VarInit,
return a new VarListElementInit referencing the VarInit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71787 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/Record.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp index 2e64c83..d420e63 100644 --- a/utils/TableGen/Record.cpp +++ b/utils/TableGen/Record.cpp @@ -639,8 +639,12 @@ Init *VarInit::resolveListElementReference(Record &R, const RecordVal *IRV, RecordVal *RV = R.getValue(getName()); assert(RV && "Reference to a non-existant variable?"); ListInit *LI = dynamic_cast<ListInit*>(RV->getValue()); - assert(LI && "Invalid list element!"); - + if (!LI) { + VarInit *VI = dynamic_cast<VarInit*>(RV->getValue()); + assert(VI && "Invalid list element!"); + return new VarListElementInit(VI, Elt); + } + if (Elt >= LI->getSize()) return 0; // Out of range reference. Init *E = LI->getElement(Elt); |