[llvm-commits] [llvm] r71787 - /llvm/trunk/utils/TableGen/Record.cpp

David Greene greened at obbligato.org
Thu May 14 13:39:32 PDT 2009


Author: greened
Date: Thu May 14 15:38:52 2009
New Revision: 71787

URL: http://llvm.org/viewvc/llvm-project?rev=71787&view=rev
Log:

Fix PR4207.

If we're resolving a list element access and we're given a VarInit,
return a new VarListElementInit referencing the VarInit.

Modified:
    llvm/trunk/utils/TableGen/Record.cpp

Modified: llvm/trunk/utils/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/Record.cpp?rev=71787&r1=71786&r2=71787&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/Record.cpp (original)
+++ llvm/trunk/utils/TableGen/Record.cpp Thu May 14 15:38:52 2009
@@ -639,8 +639,12 @@
   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);





More information about the llvm-commits mailing list