[PATCH] D137562: [clang][Interp] Start supporting virtual base classes

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 14 12:45:36 PST 2022


shafik added inline comments.


================
Comment at: clang/lib/AST/Interp/Descriptor.cpp:126
+  auto CtorSub = [=](unsigned SubOff, Descriptor *F, bool IsBase,
+                     bool Recurse = true) {
     auto *Desc = reinterpret_cast<InlineDescriptor *>(Ptr + SubOff) - 1;
----------------
To recurse or not seems to be a property of whether the base is virtual or not.

Maybe a enum w/ `Base` and `Virtual` base would be better and then the logic of whether to recurse can be kept local to the lambda,


================
Comment at: clang/lib/AST/Interp/Descriptor.cpp:147
   for (const auto &V : D->ElemRecord->virtual_bases())
-    CtorSub(V.Offset, V.Desc, /*isBase=*/true);
+    CtorSub(V.Offset, V.Desc, /*isBase=*/true, false);
 }
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137562



More information about the cfe-commits mailing list