[clang] [clang] implement __builtin_mangled_name (PR #236294)

Matthias Wippich via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 28 08:08:54 PDT 2026


================
@@ -1951,7 +1957,11 @@ TypeTraitExpr *TypeTraitExpr::Create(const ASTContext &C, QualType T,
                                      SourceLocation RParenLoc, APValue Value) {
   void *Mem =
       C.Allocate(totalSizeToAlloc<APValue, TypeSourceInfo *>(1, Args.size()));
-  return new (Mem) TypeTraitExpr(T, Loc, Kind, Args, RParenLoc, Value);
+  auto *E =
+      new (Mem) TypeTraitExpr(T, Loc, Kind, Args, RParenLoc, std::move(Value));
+  if (E->getTrailingObjects<APValue>()->needsCleanup())
+    C.addDestruction(E->getTrailingObjects<APValue>());
----------------
Tsche wrote:

I believe we do need cleanup for the array case (string trait result is stored as array in APValue to avoid adding another trailing obj)

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


More information about the cfe-commits mailing list