[PATCH] D44104: TableGen: Add !foldl operation
Artem Belevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 5 17:15:33 PST 2018
tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.
LGTM. Few minor style questions.
================
Comment at: docs/TableGen/LangRef.rst:98-101
:!eq !if !head !tail !con
:!add !shl !sra !srl !and
:!or !empty !subst !foreach !strconcat
+ :!cast !listconcat !size !foldl
----------------
Should we sort them?
================
Comment at: lib/TableGen/TGParser.cpp:1251-1252
+ if (!Start) {
+ TokError("could not get type of !foldl start");
+ return nullptr;
+ }
----------------
tra wrote:
> You seem to mix `fold` and `!foldl` in the error messages throughout the function. Is that intentional? I'd use `!foldl` everywhere for consistency.
Would it make sense to print `StartUntyped` here, too? I often find TableGen failures baffling, specifically because tablegen will usually (sometimes?) tell you *where* tablegen ran into the problem, but it rarely tells you what exactly it saw after all the folding that made it unhappy. Better error reporting in general should probably be a patch, but I doubt there will be many voices against better error reporting in new code. :-)
================
Comment at: lib/TableGen/TGParser.cpp:1251-1258
+ TokError("could not get type of !foldl start");
+ return nullptr;
+ }
+
+ if (Lex.getCode() != tgtok::comma) {
+ TokError("expected ',' in fold operator");
+ return nullptr;
----------------
You seem to mix `fold` and `!foldl` in the error messages throughout the function. Is that intentional? I'd use `!foldl` everywhere for consistency.
Repository:
rL LLVM
https://reviews.llvm.org/D44104
More information about the llvm-commits
mailing list