[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 30 14:53:50 PDT 2023


chapuni added a comment.

@arsenm Thanks for your reviews!



================
Comment at: llvm/lib/TableGen/TGParser.cpp:1527
+        assert(isa<IntRecTy>(Arg0Ty));
+        assert(isa<IntRecTy>(cast<TypedInit>(InitList[1])->getType()));
+        LHS = Arg0;
----------------
arsenm wrote:
> I still see separate isa and cast?
The inner `cast` was for `TypedInit::getType()`. Anyways, I have rewritten more consistent.



================
Comment at: llvm/test/TableGen/range-op-fail.td:26
+// ERR3: [[FILE]]:[[@LINE+1]]:22: error: expected list or int, got value of type 'string'
+defvar errs = !range("hoge", "fuga");
+#endif
----------------
arsenm wrote:
> Test with mixed integer and not-integer
This detects that 1st arg is not integer.
OTOH, I suppose `ERR1` would cover if 1st arg was integer.


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