mysterymath wrote:

> To ensure we don't destroy objects that weren't constructed, you can use a 
> guard variable of some sort, sure. I'm not quite sure what the goal is, here; 
> are you trying to improve performance, or are you worried about the function 
> pointers for security?

The scenario that brought this up was `constinit` globals still generating 
constructors that just call `__cxa_atexit`; this behavior was regarded as prima 
facie "odd", since it invokes quite a lot of mechanism just to register 
statically-known destructors.

With an approach like this, such constructors wouldn't need to be generated; 
the little state machine in the module constructor function would take it as 
granted that such "constructors" executed successfully. We'd probably need some 
additional mechanism in Clang's data structures to keep track of this though.

https://github.com/llvm/llvm-project/pull/115788
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to