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

NAKAMURA Takumi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 9 02:25:18 PDT 2023


chapuni added inline comments.


================
Comment at: llvm/lib/TableGen/Record.cpp:1212
+    auto *RHSi = dyn_cast<IntInit>(RHS);
+    if (LHSi && RHSi) {
+      auto Start = LHSi->getValue();
----------------
arsenm wrote:
> Can early break and reduce indentation 
I followed old code style around. Updated.
(Frankly said, I started from copypaste)


================
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:
> 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 
Put `string` for each position.
(and rename cases as unnumbered)


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