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

via cfe-commits cfe-commits at lists.llvm.org
Mon May 26 10:46:12 PDT 2025


================
@@ -2538,6 +2541,311 @@ static RValue EmitHipStdParUnsupportedBuiltin(CodeGenFunction *CGF,
   return RValue::get(CGF->Builder.CreateCall(UBF, Args));
 }
 
+namespace {
+
+struct PaddingClearer {
+  PaddingClearer(CodeGenFunction &F)
+      : CGF(F), CharWidth(CGF.getContext().getCharWidth()) {}
+
+  void run(Value *Ptr, QualType Ty) {
+    OccuppiedIntervals.clear();
+    Queue.clear();
+
+    Queue.push_back(Data{0, Ty, true});
+    while (!Queue.empty()) {
+      auto Current = Queue.front();
+      Queue.pop_front();
----------------
huixie90 wrote:

Thanks for the suggestion. May I clarify what the alternative are you suggesting? is it `vector`? The reason I chose `deque` is that we have lots of `push` and `pop` operations and the length of the queue won't be know up-front. We discover more elements while search down the tree. 

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


More information about the cfe-commits mailing list