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 | ccf85ded583167cbdbc20043e698eda8a7c2ed7d (patch) | |
tree | 6f4758641d0f2ef4ac2dbefc34311bbecf031e21 | |
parent | 2b2c0d716a6a6ebdf5fdb805d9a639dcc057d83a (diff) | |
download | external_llvm-ccf85ded583167cbdbc20043e698eda8a7c2ed7d.zip external_llvm-ccf85ded583167cbdbc20043e698eda8a7c2ed7d.tar.gz external_llvm-ccf85ded583167cbdbc20043e698eda8a7c2ed7d.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
-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); |