[PATCH] Fix error in tablegen when second operand of an !if is an empty list.

Duncan P. N. Exon Smith dexonsmith at apple.com
Sun Feb 16 15:37:26 PST 2014


Testcase?

On 2014 Feb 7, at 15:00, Matt Arsenault <Matthew.Arsenault at amd.com> wrote:

> !if([Something], []) would error with "No type for list".
> 
> 
> http://llvm-reviews.chandlerc.com/D2724
> 
> Files:
>  lib/TableGen/TGParser.cpp
> 
> Index: lib/TableGen/TGParser.cpp
> ===================================================================
> --- lib/TableGen/TGParser.cpp
> +++ lib/TableGen/TGParser.cpp
> @@ -1028,7 +1028,13 @@
>     }
>     Lex.Lex();  // eat the ','
> 
> -    Init *RHS = ParseValue(CurRec);
> +    // Get the type in case the second operand might be an empty list. We can
> +    // infer the next item's type is the same.
> +    RecTy *MHSTy = 0;
> +    if (TypedInit *MHSt = dyn_cast<TypedInit>(MHS))
> +      MHSTy = MHSt->getType();
> +
> +    Init *RHS = ParseValue(CurRec, MHSTy);
>     if (RHS == 0) return 0;
> 
>     if (Lex.getCode() != tgtok::r_paren) {
> <D2724.1.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list