================ @@ -2234,6 +2234,101 @@ enum class CXXNewInitializationStyle { Braces }; +enum class TypeAwareAllocationMode : unsigned { No, Yes }; +inline bool isTypeAwareAllocation(TypeAwareAllocationMode Mode) { + return Mode == TypeAwareAllocationMode::Yes; +} +inline TypeAwareAllocationMode +typeAwareAllocationModeFromBool(bool IsTypeAwareAllocation) { + return IsTypeAwareAllocation ? TypeAwareAllocationMode::Yes + : TypeAwareAllocationMode::No; +} + +enum class AlignedAllocationMode : unsigned { No, Yes }; +inline bool isAlignedAllocation(AlignedAllocationMode Mode) { + return Mode == AlignedAllocationMode::Yes; +} +inline AlignedAllocationMode alignedAllocationModeFromBool(bool IsAligned) { + return IsAligned ? AlignedAllocationMode::Yes : AlignedAllocationMode::No; +} + +enum class SizedDeallocationMode : unsigned { No, Yes }; +inline bool isSizedDeallocation(SizedDeallocationMode Mode) { + return Mode == SizedDeallocationMode::Yes; +} +inline SizedDeallocationMode sizedDeallocationModeFromBool(bool IsSized) { + return IsSized ? SizedDeallocationMode::Yes : SizedDeallocationMode::No; +} + +struct ImplicitAllocationParameters { + ImplicitAllocationParameters(QualType Type, + TypeAwareAllocationMode PassTypeIdentity, + AlignedAllocationMode PassAlignment) + : Type(Type.isNull() ? Type : Type.getUnqualifiedType()), + PassTypeIdentity(PassTypeIdentity), PassAlignment(PassAlignment) { + if (Type.isNull()) + assert(!isTypeAwareAllocation(PassTypeIdentity)); + assert(!Type.isNull()); + } + explicit ImplicitAllocationParameters(AlignedAllocationMode PassAlignment) ---------------- cor3ntin wrote:
This looks fine as is. Marking as resolved to make progress https://github.com/llvm/llvm-project/pull/113510 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits