[clang] [Clang] [C++26] Implement P2573R2: `= delete("should have a reason");` (PR #86526)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 10 06:43:40 PDT 2024
================
@@ -3092,30 +3092,65 @@ bool FunctionDecl::isVariadic() const {
return false;
}
-FunctionDecl::DefaultedFunctionInfo *
-FunctionDecl::DefaultedFunctionInfo::Create(ASTContext &Context,
- ArrayRef<DeclAccessPair> Lookups) {
- DefaultedFunctionInfo *Info = new (Context.Allocate(
- totalSizeToAlloc<DeclAccessPair>(Lookups.size()),
- std::max(alignof(DefaultedFunctionInfo), alignof(DeclAccessPair))))
- DefaultedFunctionInfo;
+FunctionDecl::DefaultedOrDeletedFunctionInfo *
+FunctionDecl::DefaultedOrDeletedFunctionInfo::Create(
+ ASTContext &Context, ArrayRef<DeclAccessPair> Lookups,
+ StringLiteral *DeletedMessage) {
+ static constexpr size_t Alignment =
+ std::max({alignof(DefaultedOrDeletedFunctionInfo),
+ alignof(DeclAccessPair), alignof(StringLiteral *)});
+ size_t Size = totalSizeToAlloc<DeclAccessPair, StringLiteral *>(
+ Lookups.size(), !!DeletedMessage);
----------------
erichkeane wrote:
```suggestion
Lookups.size(), DeletedMessage != nullptr);
```
https://github.com/llvm/llvm-project/pull/86526
More information about the cfe-commits
mailing list