[PATCH] D145871: TableGen: Introduce `!range` operator for half-opened interval

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 7 15:53:00 PDT 2023


arsenm added inline comments.


================
Comment at: llvm/lib/TableGen/Record.cpp:1212
+    auto *RHSi = dyn_cast<IntInit>(RHS);
+    if (LHSi && RHSi) {
+      auto Start = LHSi->getValue();
----------------
Can early break and reduce indentation 


================
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
----------------
chapuni wrote:
> 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.
Right but you aren't testing the error is produced for each position individually 


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