[PATCH] D81074: [TableGen] Add error messages
Daniel Sanders via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 3 09:53:18 PDT 2020
dsanders added inline comments.
================
Comment at: llvm/utils/TableGen/SearchableTableEmitter.cpp:122-128
+ else if (Field.Enum) {
+ auto *Entry = Field.Enum->EntryMap[cast<DefInit>(I)->getDef()];
+ if (!Entry)
+ PrintFatalError(Twine("entry for field '") + Field.Name + "' is null");
return std::string(
Field.Enum->EntryMap[cast<DefInit>(I)->getDef()]->first);
+ }
----------------
This one makes sense to me. The return statement ought to be updated to use Entry though:
`return std::string(Entry->first)`
================
Comment at: llvm/utils/TableGen/SearchableTableEmitter.cpp:603-605
+ if (Items.empty())
+ PrintFatalError(Twine("Table '") + Table.Name + "' has no items");
+
----------------
I'm not sure this one should really be an error as having an empty table doesn't seem wrong as such. It probably wasn't intentional though so maybe a warning makes sense.
What breaks if the table is empty?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81074/new/
https://reviews.llvm.org/D81074
More information about the llvm-commits
mailing list