[libcxx-commits] [clang] [libcxx] [clang] Add builtin to clear padding bytes (prework for P0528R3) (PR #75371)

Eli Friedman via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 30 15:55:22 PDT 2026


================
@@ -4969,6 +5253,13 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
 
     return RValue::get(Ptr);
   }
+  case Builtin::BI__builtin_clear_padding: {
+    Address Src = EmitPointerWithAlignment(E->getArg(0));
+    auto PointeeTy = E->getArg(0)->getType()->getPointeeType();
+    PaddingClearer clearer{*this};
+    clearer.run(Src.getBasePointer(), PointeeTy);
----------------
efriedma-quic wrote:

I don't think it's safe to throw away the alignment here... please just pass the Address into PaddingClearer so the existing infrastructure tracks the alignment for you.

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


More information about the libcxx-commits mailing list