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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed May 13 07:31: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()) {
----------------
AaronBallman wrote:

Do we have to look at base classes and their fields too?

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


More information about the cfe-commits mailing list