[PATCH] D145871: TableGen: Introduce `!range` operator for half-opened interval
NAKAMURA Takumi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 16 07:22:20 PDT 2023
chapuni marked 3 inline comments as done.
chapuni added inline comments.
================
Comment at: llvm/lib/TableGen/TGParser.cpp:1508
+ Init *LHS, *RHS;
+ auto *Arg0 = dyn_cast<TypedInit>(InitList[0]);
+ switch (InitList.size()) {
----------------
nhaehnle wrote:
> You're relying here on the cast always being successful (which makes sense), so you should use `cast` instead of `dyn_cast`. (This has the benefit of raising an assertion if the cast fails.)
I have misunderstood `cast<ty>` as it would crash with incompatible type.
Thanks for pointing out.
================
Comment at: llvm/lib/TableGen/TGParser.cpp:1509
+ auto *Arg0 = dyn_cast<TypedInit>(InitList[0]);
+ switch (InitList.size()) {
+ case 1:
----------------
nhaehnle wrote:
> Using a `switch` for this instead of an `if/else` chain is a bit unorthodox, but I suppose we can live with it.
I avoided duplicate usages of `InitList.size()`, even if they were optimized out.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145871/new/
https://reviews.llvm.org/D145871
More information about the llvm-commits
mailing list