[clang] [RFC] Initial implementation of P2719 (PR #113510)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 4 21:46:08 PST 2024


================
@@ -2234,6 +2234,17 @@ enum class CXXNewInitializationStyle {
   Braces
 };
 
+struct ImplicitAllocationParameters {
+  bool PassTypeIdentity;
----------------
ojhunt wrote:

What is the rationale for bitfields?

I'm generally opposed to flag enums as the language support is so poor, and unless there are very real performance considerations I'm not convinced they're worth the code complexity cost.

I did originally try to unify Allocation and Deallocation but the usage of them in the code base differs a bit (one is much more "try to do this" vs the other's "do this") and I found that keeping them distinct gave clarity to the code.

In general the way the new and delete AST construction works is kind of gnarly in a way I wish we could avoid as I think it creates unnecessary complexity in some places, and just causes weirdness in others, but I didn't want to combine "lets add a new feature to new/delete" and at the same time "lets completely restructure how new/delete work". I adopted these structs largely because there were already two undifferentiated bool args, and adding a third made things even more opaque, especially in conjunction with the extensive use of default parameters.

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


More information about the cfe-commits mailing list