[clang] [llvm] [mlir] [TableGen] Only store direct superclasses in Record (PR #123072)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 09:37:28 PST 2025


================
@@ -1630,9 +1630,9 @@ class Record {
   SmallVector<AssertionInfo, 0> Assertions;
   SmallVector<DumpInfo, 0> Dumps;
 
-  // All superclasses in the inheritance forest in post-order (yes, it
+  // Direct superclasses, which are roots of the inheritance forest (yes, it
   // must be a forest; diamond-shaped inheritance is not allowed).
-  SmallVector<std::pair<const Record *, SMRange>, 0> SuperClasses;
+  SmallVector<std::pair<const Record *, SMRange>, 0> DirectSuperClasses;
----------------
mshockwave wrote:

Given the fact that we're only storing a small number of direct super classes now, would it make more sense to use SmallVector<..., N> with N not equal to zero? N = 0 will disable any stack allocation and allocate on heap only, IIRC

https://github.com/llvm/llvm-project/pull/123072


More information about the llvm-commits mailing list