[clang] [CIR] Lower builtin_launder (PR #197252)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed May 13 08:20:50 PDT 2026


================
@@ -5558,6 +5558,38 @@ QualType::DestructionKind QualType::isDestructedTypeImpl(QualType type) {
   return DK_none;
 }
 
+static bool
+requiresBuiltinLaunderImpl(const ASTContext &Context, QualType Ty,
+                           llvm::SmallPtrSetImpl<const Decl *> &Seen) {
+  if (const auto *Arr = Context.getAsArrayType(Ty))
+    Ty = Context.getBaseElementType(Arr);
+
+  const auto *Record = Ty->getAsCXXRecordDecl();
+  if (!Record)
+    return false;
+
+  // We've already checked this type, or are in the process of checking it.
+  if (!Seen.insert(Record).second)
+    return false;
+
+  assert(Record->hasDefinition() &&
+         "Incomplete types should already be diagnosed");
+
+  if (Record->isDynamicClass())
+    return true;
+
+  for (FieldDecl *F : Record->fields()) {
----------------
erichkeane wrote:

Seemingly no.  Best I can tell is the `isDynamicClass` test considers dynamic bases as well: 
https://godbolt.org/z/6rTdaqr66

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


More information about the cfe-commits mailing list