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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 16:19:05 PST 2021


craig.topper added inline comments.


================
Comment at: llvm/include/llvm/TableGen/Record.h:1999
 
+  bool isComplete(Init *Key) { return Map[Key].V->isComplete(); }
+
----------------
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().



================
Comment at: llvm/lib/TableGen/TGParser.cpp:2612
+    BadField = AddValue(CurRec, IdLoc,
+                         RecordVal(DeclName, IdLoc, Type,
+                                   HasField ? RecordVal::FK_NonconcreteOK
----------------
Please run clang-format


================
Comment at: llvm/lib/TableGen/TGParser.cpp:2628
+  } else {
+    assert(false && "invalid context for template argument");
   }
----------------
llvm_unreachable


================
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>;
----------------
nvalid?


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