[PATCH] D94822: [TableGen] Improve algorithm for inheriting class template arguments and fields

Paul C. Anagnostopoulos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 16:37:04 PST 2021


Paul-C-Anagnostopoulos added inline comments.


================
Comment at: llvm/include/llvm/TableGen/Record.h:1999
 
+  bool isComplete(Init *Key) { return Map[Key].V->isComplete(); }
+
----------------
craig.topper wrote:
> This strongly assumes that Key is in the map with a non-null value. if it isn't the map, it will get inserted with a null V.
> 
> Maybe better to make this const, and use Map.find(Key) and assert that it doesn't return Map.end().
> 
Good point. In the one use so far, it is in the map, but we don't want to assume that.


================
Comment at: llvm/lib/TableGen/TGParser.cpp:2612
+    BadField = AddValue(CurRec, IdLoc,
+                         RecordVal(DeclName, IdLoc, Type,
+                                   HasField ? RecordVal::FK_NonconcreteOK
----------------
craig.topper wrote:
> Please run clang-format
I've never run it. Doesn't it reformat the entire file?


================
Comment at: llvm/test/TableGen/self-reference-typeerror.td:12
 //
-// CHECK: Field 'A:x' of type 'A' is incompatible with value
+// CHECK: nvalid value of type '{}' found when setting field 'a' of type 'A'
 def A0 : A<A0>;
----------------
craig.topper wrote:
> nvalid?
So it doesn't matter whether the first word of the message is capitalized.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94822



More information about the llvm-commits mailing list