[clang] [clang] Add __builtin_start_object_lifetime builtin. (PR #82776)

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 23 14:11:08 PST 2024


================
@@ -896,6 +896,12 @@ def Launder : Builtin {
   let Prototype = "void*(void*)";
 }
 
+def StartObjectLifeTime : Builtin {
----------------
sam-mccall wrote:

For creating-objects-via-memcpy, what are we planning to do about the memcpy part being UB and the start_lifetime part being correspondingly hard to specify (what's the relationship between the bytes and the new objects?)

I thought a combined memcpy + start_object_lifetime intrinsic would solve this neatly (values of new objects are the values of the old objects), but certainly we want the start-lifetime-only part to support start_lifetime_as.  

I don't see a great way out for non-implicit-lifetime types though...

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


More information about the cfe-commits mailing list