[PATCH] D85585: Replace TableGen range piece punctuator with '..'

Paul C. Anagnostopoulos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 15:31:09 PDT 2020


Paul-C-Anagnostopoulos added a comment.

In D85585#2208140 <https://reviews.llvm.org/D85585#2208140>, @dblaikie wrote:

> I don't really work with tablegen, so someone else will need to review the substance of this change.
>
> One nit (provided inline) and one general question: does the '-' range separator produce any usability problems for users of tablegen, or does it only complicate the implementation? (though, admittedly, {-5--2} isn't terribly readable, so even if it works, I can see usability benefit in changing to {-5..-2})

The primary purpose of the change is to remove a rather odd bit of syntax that requires an almost apologetic description in the documentation.

Negative numbers aren't allowed in ranges, so the worst use of the hyphen would be in something like {2-+5}. But, again, it's mainly to clean up the documentation.



================
Comment at: llvm/lib/TableGen/TGLexer.cpp:188-189
+      ++CurPtr; // Eat second period.
+      return tgtok::range;
+    } else {
+      return tgtok::period;
----------------
dblaikie wrote:
> Avoid else after return: https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return
Ah, okay. I'll remove the else and drop through to the second return.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85585/new/

https://reviews.llvm.org/D85585



More information about the llvm-commits mailing list