https://github.com/erichkeane edited
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
@@ -9753,27 +9753,46 @@ def err_operator_new_delete_invalid_result_type : Error<
def err_operator_new_delete_dependent_result_type : Error<
"%0 cannot have a dependent return type; use %1 instead">;
def err_operator_new_delete_too_few_parameters : Error<
- "%0 must have at l
https://github.com/cor3ntin edited
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
@@ -16421,33 +16715,70 @@ CheckOperatorDeleteDeclaration(Sema &SemaRef,
FunctionDecl *FnDecl) {
return true;
auto *MD = dyn_cast(FnDecl);
+ auto ConstructDestroyingDeleteAddressType = [&]() {
+assert(MD);
+return SemaRef.Context.getCanonicalType(SemaRef.Context
@@ -9753,27 +9753,46 @@ def err_operator_new_delete_invalid_result_type : Error<
def err_operator_new_delete_dependent_result_type : Error<
"%0 cannot have a dependent return type; use %1 instead">;
def err_operator_new_delete_too_few_parameters : Error<
- "%0 must have at l
@@ -9753,27 +9753,46 @@ def err_operator_new_delete_invalid_result_type : Error<
def err_operator_new_delete_dependent_result_type : Error<
"%0 cannot have a dependent return type; use %1 instead">;
def err_operator_new_delete_too_few_parameters : Error<
- "%0 must have at l
https://github.com/cor3ntin commented:
A few nits.
My intent is to approve the pr once they are addressed
@AaronBallman @erichkeane
https://github.com/llvm/llvm-project/pull/113510
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.
@@ -16223,6 +16324,70 @@ bool Sema::CompleteConstructorCall(CXXConstructorDecl
*Constructor,
return Invalid;
}
+bool Sema::isTypeAwareOperatorNewOrDelete(const NamedDecl *ND) const {
+ const FunctionDecl *FnDecl = nullptr;
ojhunt wrote:
Removed and replac
@@ -2234,6 +2234,101 @@ enum class CXXNewInitializationStyle {
Braces
};
+enum class TypeAwareAllocationMode : unsigned { No, Yes };
+inline bool isTypeAwareAllocation(TypeAwareAllocationMode Mode) {
+ return Mode == TypeAwareAllocationMode::Yes;
+}
+inline TypeAwareAllocat
@@ -312,6 +312,7 @@ LANGOPT(OpenACC , 1, 0, "OpenACC Enabled")
LANGOPT(MSVCEnableStdcMacro , 1, 0, "Define __STDC__ with
'-fms-compatibility'")
LANGOPT(SizedDeallocation , 1, 0, "sized deallocation")
+LANGOPT(TypeAwareAllocators , 1, 1, "type aware C++ allocation op
@@ -7353,6 +7354,69 @@ void Sema::CheckCompletedCXXClass(Scope *S,
CXXRecordDecl *Record) {
else if (Record->hasAttr())
checkCUDADeviceBuiltinTextureClassTemplate(*this, Record);
}
+
+ llvm::SmallVector TypeAwareNewDecls;
+ llvm::SmallVector TypeAwareDeleteDecls;
@@ -7353,6 +7354,69 @@ void Sema::CheckCompletedCXXClass(Scope *S,
CXXRecordDecl *Record) {
else if (Record->hasAttr())
checkCUDADeviceBuiltinTextureClassTemplate(*this, Record);
}
+
+ llvm::SmallVector TypeAwareNewDecls;
+ llvm::SmallVector TypeAwareDeleteDecls;
@@ -2527,6 +2527,32 @@ class FunctionDecl : public DeclaratorDecl,
/// If this function is an allocation/deallocation function that takes
/// the `std::nothrow_t` tag, return true through IsNothrow,
bool isReplaceableGlobalAllocationFunction(
+ std::optional *Alignme
@@ -1098,12 +1098,39 @@ static TypeSourceInfo
*getTypeSourceInfoForStdAlignValT(Sema &S,
return S.Context.getTrivialTypeSourceInfo(StdAlignValDecl);
}
+// When searching for custom allocators on the PromiseType we want to
+// warn that we will ignore type aware allocators.
@@ -16439,33 +16735,70 @@ CheckOperatorDeleteDeclaration(Sema &SemaRef,
FunctionDecl *FnDecl) {
return true;
auto *MD = dyn_cast(FnDecl);
+ auto ConstructDestroyingDeleteAddressType = [&]() {
+assert(MD);
+return SemaRef.Context.getCanonicalType(SemaRef.Context
@@ -2474,19 +2474,46 @@ bool CXXMethodDecl::isUsualDeallocationFunction(
getOverloadedOperator() != OO_Array_Delete)
return false;
+ auto NumParams = getNumParams();
+ bool IsTypeAware = IsTypeAwareOperatorNewOrDelete();
+
// C++ [basic.stc.dynamic.deallocation]
https://github.com/ojhunt edited
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
@@ -1098,12 +1098,39 @@ static TypeSourceInfo
*getTypeSourceInfoForStdAlignValT(Sema &S,
return S.Context.getTrivialTypeSourceInfo(StdAlignValDecl);
}
+// When searching for custom allocators on the PromiseType we want to
+// warn that we will ignore type aware allocators.
@@ -17389,6 +17389,19 @@ Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind
TUK, SourceLocation KWLoc,
Previous.clear();
}
+ // I think DC check should be DC->isStdNamespace()?
ojhunt wrote:
@erichkeane so I think this was a case where the test can
@@ -16147,6 +16169,108 @@ bool Sema::CompleteConstructorCall(CXXConstructorDecl
*Constructor,
return Invalid;
}
+bool Sema::isTypeAwareOperatorNewOrDelete(const NamedDecl *ND) const {
+ const FunctionDecl *FnDecl = nullptr;
+ if (auto *FTD = dyn_cast(ND))
+FnDecl = FT
@@ -1095,12 +1095,40 @@ static TypeSourceInfo
*getTypeSourceInfoForStdAlignValT(Sema &S,
return S.Context.getTrivialTypeSourceInfo(StdAlignValDecl);
}
+// When searching for custom allocators on the PromiseType we want to
+// warn that we will ignore type aware allocators.
@@ -3096,6 +3096,29 @@ bool Type::isStdByteType() const {
return false;
}
+TemplateDecl *Type::getSpecializedTemplateDecl() const {
+ const auto *DesugaredType = getUnqualifiedDesugaredType();
+ if (auto *Specialization =
DesugaredType->getAs())
+return Specialization
@@ -1586,8 +1597,22 @@ bool CoroutineStmtBuilder::makeNewAndDeleteExpr() {
if (NewRef.isInvalid())
return false;
- SmallVector NewArgs(1, FrameSize);
- if (S.getLangOpts().CoroAlignedAllocation && PassAlignment)
+ SmallVector NewArgs;
+ if (IAP.PassTypeIdentity) {
+
@@ -9688,6 +9688,18 @@ def err_operator_delete_param_type : Error<
def err_destroying_operator_delete_not_usual : Error<
"destroying operator delete can have only an optional size and optional "
"alignment parameter">;
+def err_type_aware_destroying_operator_delete : Error<
@@ -2474,19 +2474,46 @@ bool CXXMethodDecl::isUsualDeallocationFunction(
getOverloadedOperator() != OO_Array_Delete)
return false;
+ auto NumParams = getNumParams();
ojhunt wrote:
Done.
https://github.com/llvm/llvm-project/pull/113510
_
@@ -3482,15 +3486,40 @@ bool FunctionDecl::isDestroyingOperatorDelete() const {
// Within a class C, a single object deallocation function with signature
// (T, std::destroying_delete_t, )
// is a destroying operator delete.
- if (!isa(this) || getOverloadedOpera
@@ -1392,7 +1393,13 @@ static UsualDeleteParams getUsualDeleteParams(const
FunctionDecl *FD) {
const FunctionProtoType *FPT = FD->getType()->castAs();
auto AI = FPT->param_type_begin(), AE = FPT->param_type_end();
- // The first argument is always a void*.
+ if (FD->isT
@@ -3096,6 +3096,29 @@ bool Type::isStdByteType() const {
return false;
}
+TemplateDecl *Type::getSpecializedTemplateDecl() const {
+ const auto *DesugaredType = getUnqualifiedDesugaredType();
+ if (auto *Specialization =
DesugaredType->getAs())
+return Specialization
@@ -16147,6 +16169,108 @@ bool Sema::CompleteConstructorCall(CXXConstructorDecl
*Constructor,
return Invalid;
}
+bool Sema::isTypeAwareOperatorNewOrDelete(const NamedDecl *ND) const {
+ const FunctionDecl *FnDecl = nullptr;
+ if (auto *FTD = dyn_cast(ND))
+FnDecl = FT
@@ -1435,6 +1444,8 @@ namespace {
unsigned NumPlacementArgs : 31;
LLVM_PREFERRED_TYPE(bool)
unsigned PassAlignmentToPlacementDelete : 1;
+LLVM_PREFERRED_TYPE(bool)
+unsigned PassTypeToPlacementDelete : 1;
ojhunt wrote:
Should we add a stati
@@ -9817,27 +9817,54 @@ def err_operator_new_delete_invalid_result_type : Error<
def err_operator_new_delete_dependent_result_type : Error<
"%0 cannot have a dependent return type; use %1 instead">;
def err_operator_new_delete_too_few_parameters : Error<
- "%0 must have at l
@@ -1586,8 +1597,22 @@ bool CoroutineStmtBuilder::makeNewAndDeleteExpr() {
if (NewRef.isInvalid())
return false;
- SmallVector NewArgs(1, FrameSize);
- if (S.getLangOpts().CoroAlignedAllocation && PassAlignment)
+ SmallVector NewArgs;
+ if (IAP.PassTypeIdentity) {
+
@@ -2474,19 +2474,46 @@ bool CXXMethodDecl::isUsualDeallocationFunction(
getOverloadedOperator() != OO_Array_Delete)
return false;
+ auto NumParams = getNumParams();
+ bool IsTypeAware = IsTypeAwareOperatorNewOrDelete();
+
// C++ [basic.stc.dynamic.deallocation]
@@ -16110,6 +16128,127 @@ bool Sema::CompleteConstructorCall(CXXConstructorDecl
*Constructor,
return Invalid;
}
+bool Sema::IsTypeIdentitySpecialization(QualType Type) const {
+ auto *TypeIdentity = getStdTypeIdentity();
+ if (!TypeIdentity)
+return false;
+ auto *Sp
https://github.com/ojhunt commented:
> *[Reviewable](https://reviewable.io/reviews/llvm/llvm-project/113510)*
> status: 0 of 62 files reviewed, 127 unresolved discussions (waiting on
> @AaronBallman, @Bigcheese, @ChuanqiXu9, @cor3ntin, @efriedma-quic,
> @erichkeane, @mizvekov, @ogiroux, @Sir
@@ -1466,17 +1477,30 @@ namespace {
void Emit(CodeGenFunction &CGF, Flags flags) override {
const auto *FPT = OperatorDelete->getType()->castAs();
CallArgList DeleteArgs;
-
- // The first argument is always a void* (or C* for a destroying operator
- //
@@ -2527,6 +2527,32 @@ class FunctionDecl : public DeclaratorDecl,
/// If this function is an allocation/deallocation function that takes
/// the `std::nothrow_t` tag, return true through IsNothrow,
bool isReplaceableGlobalAllocationFunction(
+ std::optional *Alignme
@@ -1098,12 +1098,39 @@ static TypeSourceInfo
*getTypeSourceInfoForStdAlignValT(Sema &S,
return S.Context.getTrivialTypeSourceInfo(StdAlignValDecl);
}
+// When searching for custom allocators on the PromiseType we want to
+// warn that we will ignore type aware allocators.
@@ -1098,12 +1098,39 @@ static TypeSourceInfo
*getTypeSourceInfoForStdAlignValT(Sema &S,
return S.Context.getTrivialTypeSourceInfo(StdAlignValDecl);
}
+// When searching for custom allocators on the PromiseType we want to
+// warn that we will ignore type aware allocators.
@@ -16327,79 +16531,181 @@ static CanQualType RemoveAddressSpaceFromPtr(Sema
&SemaRef,
PtrTy->getPointeeType().getUnqualifiedType(), PtrQuals)));
}
-static inline bool
-CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
-C
@@ -1098,12 +1098,39 @@ static TypeSourceInfo
*getTypeSourceInfoForStdAlignValT(Sema &S,
return S.Context.getTrivialTypeSourceInfo(StdAlignValDecl);
}
+// When searching for custom allocators on the PromiseType we want to
+// warn that we will ignore type aware allocators.
@@ -7353,6 +7354,69 @@ void Sema::CheckCompletedCXXClass(Scope *S,
CXXRecordDecl *Record) {
else if (Record->hasAttr())
checkCUDADeviceBuiltinTextureClassTemplate(*this, Record);
}
+
+ llvm::SmallVector TypeAwareNewDecls;
+ llvm::SmallVector TypeAwareDeleteDecls;
@@ -16327,79 +16531,181 @@ static CanQualType RemoveAddressSpaceFromPtr(Sema
&SemaRef,
PtrTy->getPointeeType().getUnqualifiedType(), PtrQuals)));
}
-static inline bool
-CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
-C
@@ -7353,6 +7354,69 @@ void Sema::CheckCompletedCXXClass(Scope *S,
CXXRecordDecl *Record) {
else if (Record->hasAttr())
checkCUDADeviceBuiltinTextureClassTemplate(*this, Record);
}
+
+ llvm::SmallVector TypeAwareNewDecls;
+ llvm::SmallVector TypeAwareDeleteDecls;
@@ -7353,6 +7354,69 @@ void Sema::CheckCompletedCXXClass(Scope *S,
CXXRecordDecl *Record) {
else if (Record->hasAttr())
checkCUDADeviceBuiltinTextureClassTemplate(*this, Record);
}
+
+ llvm::SmallVector TypeAwareNewDecls;
+ llvm::SmallVector TypeAwareDeleteDecls;
@@ -16439,33 +16735,70 @@ CheckOperatorDeleteDeclaration(Sema &SemaRef,
FunctionDecl *FnDecl) {
return true;
auto *MD = dyn_cast(FnDecl);
+ auto ConstructDestroyingDeleteAddressType = [&]() {
+assert(MD);
+return SemaRef.Context.getCanonicalType(SemaRef.Context
@@ -16327,79 +16531,181 @@ static CanQualType RemoveAddressSpaceFromPtr(Sema
&SemaRef,
PtrTy->getPointeeType().getUnqualifiedType(), PtrQuals)));
}
-static inline bool
-CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
-C
@@ -7353,6 +7354,69 @@ void Sema::CheckCompletedCXXClass(Scope *S,
CXXRecordDecl *Record) {
else if (Record->hasAttr())
checkCUDADeviceBuiltinTextureClassTemplate(*this, Record);
}
+
+ llvm::SmallVector TypeAwareNewDecls;
+ llvm::SmallVector TypeAwareDeleteDecls;
@@ -9817,27 +9817,54 @@ def err_operator_new_delete_invalid_result_type : Error<
def err_operator_new_delete_dependent_result_type : Error<
"%0 cannot have a dependent return type; use %1 instead">;
def err_operator_new_delete_too_few_parameters : Error<
- "%0 must have at l
@@ -16327,79 +16531,181 @@ static CanQualType RemoveAddressSpaceFromPtr(Sema
&SemaRef,
PtrTy->getPointeeType().getUnqualifiedType(), PtrQuals)));
}
-static inline bool
-CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
-C
@@ -16327,79 +16531,181 @@ static CanQualType RemoveAddressSpaceFromPtr(Sema
&SemaRef,
PtrTy->getPointeeType().getUnqualifiedType(), PtrQuals)));
}
-static inline bool
-CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
-C
@@ -1466,17 +1477,30 @@ namespace {
void Emit(CodeGenFunction &CGF, Flags flags) override {
const auto *FPT = OperatorDelete->getType()->castAs();
CallArgList DeleteArgs;
-
- // The first argument is always a void* (or C* for a destroying operator
- //
@@ -0,0 +1,145 @@
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s
-std=c++26 -fcoroutines -fexceptions -Wall -Wpedantic
+
+
+#include "Inputs/std-coroutine.h"
+
+namespace std {
+ template struct type_identity {
+ typedef T type;
+ };
+ typedef __
@@ -3128,6 +3128,26 @@ bool Type::isStdByteType() const {
return false;
}
+static const TemplateDecl *getSpecializedTemplateType(const Type *T) {
+ const Type *DesugaredType = T->getUnqualifiedDesugaredType();
+ if (const auto *Specialization =
+ DesugaredType->ge
@@ -477,6 +477,44 @@ class DeclarationName {
return OO_None;
}
+ bool isOperatorNew() const {
+if (getNameKind() != DeclarationName::CXXOperatorName)
+ return false;
+switch (getCXXOverloadedOperator()) {
+case OO_New:
+case OO_Array_New:
+ ret
@@ -307,6 +307,10 @@ EXTENSION(datasizeof, LangOpts.CPlusPlus)
FEATURE(cxx_abi_relative_vtable, LangOpts.CPlusPlus &&
LangOpts.RelativeCXXABIVTables)
+// Type aware allocators
+FEATURE(cxx_type_aware_allocators, LangOpts.TypeAwareAllocators)
ojhunt wrote:
R
@@ -1110,9 +1138,10 @@ static bool findDeleteForPromise(Sema &S, SourceLocation
Loc, QualType PromiseTy
// The deallocation function's name is looked up by searching for it in the
// scope of the promise type. If nothing is found, a search is performed in
// the global s
@@ -9784,10 +9850,16 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD,
//results in an ambiguity or in a function that is deleted or
inaccessible
if (CSM == CXXSpecialMemberKind::Destructor && MD->isVirtual()) {
FunctionDecl *OperatorDelete = nullptr;
+
@@ -16147,6 +16169,108 @@ bool Sema::CompleteConstructorCall(CXXConstructorDecl
*Constructor,
return Invalid;
}
+bool Sema::isTypeAwareOperatorNewOrDelete(const NamedDecl *ND) const {
+ const FunctionDecl *FnDecl = nullptr;
+ if (auto *FTD = dyn_cast(ND))
+FnDecl = FT
@@ -3134,6 +3134,31 @@ bool Type::isStdByteType() const {
return false;
}
+bool Type::isDestroyingDeleteT() const {
+ auto *RD = getAsCXXRecordDecl();
+ return RD && RD->isInStdNamespace() && RD->getIdentifier() &&
+ RD->getIdentifier()->isStr("destroying_delete_t"
@@ -2533,9 +2533,43 @@ bool CXXMethodDecl::isUsualDeallocationFunction(
getOverloadedOperator() != OO_Array_Delete)
ojhunt wrote:
I've adopted them in a few places, and I'm renaming them to isAnyOperatorNew,
isAnyOperatorDelete so it's less confusable wit
@@ -16298,6 +16396,70 @@ bool Sema::CompleteConstructorCall(CXXConstructorDecl
*Constructor,
return Invalid;
}
+bool Sema::isTypeAwareOperatorNewOrDelete(const NamedDecl *ND) const {
+ const FunctionDecl *FnDecl = nullptr;
+ if (auto *FTD = dyn_cast(ND))
+FnDecl = FTD
@@ -1829,10 +1829,18 @@ class DeclContext {
// refers to an enclosing template for hte purposes of [temp.friend]p9.
LLVM_PREFERRED_TYPE(bool)
uint64_t FriendConstraintRefersToEnclosingTemplate : 1;
+
+// Indicates this function is type aware operator new or dele
@@ -1829,10 +1829,18 @@ class DeclContext {
// refers to an enclosing template for hte purposes of [temp.friend]p9.
LLVM_PREFERRED_TYPE(bool)
uint64_t FriendConstraintRefersToEnclosingTemplate : 1;
+
+// Indicates this function is type aware operator new or dele
@@ -1866,13 +1959,13 @@ static UsualDeallocFnInfo resolveDeallocationOverload(
BestFns->push_back(Info);
continue;
}
-
-if (Best.isBetterThan(Info, WantSize, WantAlign))
+int ComparisonResult = Best.Compare(S, Info, IDP);
+if (ComparisonResult > 0)
@@ -2533,9 +2533,43 @@ bool CXXMethodDecl::isUsualDeallocationFunction(
getOverloadedOperator() != OO_Array_Delete)
ojhunt wrote:
*adding the new accessors and adopting them
https://github.com/llvm/llvm-project/pull/113510
@@ -16298,6 +16396,70 @@ bool Sema::CompleteConstructorCall(CXXConstructorDecl
*Constructor,
return Invalid;
}
+bool Sema::isTypeAwareOperatorNewOrDelete(const NamedDecl *ND) const {
+ const FunctionDecl *FnDecl = nullptr;
+ if (auto *FTD = dyn_cast(ND))
+FnDecl = FTD
https://github.com/cor3ntin edited
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
@@ -2520,6 +2520,18 @@ class FunctionDecl : public DeclaratorDecl,
/// If this function is an allocation/deallocation function that takes
/// the `std::nothrow_t` tag, return true through IsNothrow,
bool isReplaceableGlobalAllocationFunction(
+ std::optional *Alignme
@@ -3503,9 +3518,23 @@ bool FunctionDecl::isDestroyingOperatorDelete() const {
getNumParams() < 2)
return false;
- auto *RD = getParamDecl(1)->getType()->getAsCXXRecordDecl();
- return RD && RD->isInStdNamespace() && RD->getIdentifier() &&
- RD->getIdentifi
@@ -9817,27 +9817,54 @@ def err_operator_new_delete_invalid_result_type : Error<
def err_operator_new_delete_dependent_result_type : Error<
"%0 cannot have a dependent return type; use %1 instead">;
def err_operator_new_delete_too_few_parameters : Error<
- "%0 must have at l
@@ -2533,9 +2533,43 @@ bool CXXMethodDecl::isUsualDeallocationFunction(
getOverloadedOperator() != OO_Array_Delete)
ojhunt wrote:
Shall I just do a global search/replace/update?
Actually maybe I should just do that as a separate PR?
https://github.com/ll
@@ -0,0 +1,145 @@
+// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify %s
-std=c++26 -fcoroutines -fexceptions -Wall -Wpedantic
+
+
+#include "Inputs/std-coroutine.h"
+
+namespace std {
+ template struct type_identity {
+ typedef T type;
+ };
+ typedef __
@@ -3134,6 +3134,31 @@ bool Type::isStdByteType() const {
return false;
}
+bool Type::isDestroyingDeleteT() const {
+ auto *RD = getAsCXXRecordDecl();
+ return RD && RD->isInStdNamespace() && RD->getIdentifier() &&
+ RD->getIdentifier()->isStr("destroying_delete_t"
@@ -16298,6 +16396,70 @@ bool Sema::CompleteConstructorCall(CXXConstructorDecl
*Constructor,
return Invalid;
}
+bool Sema::isTypeAwareOperatorNewOrDelete(const NamedDecl *ND) const {
+ const FunctionDecl *FnDecl = nullptr;
+ if (auto *FTD = dyn_cast(ND))
+FnDecl = FTD
@@ -16147,6 +16169,108 @@ bool Sema::CompleteConstructorCall(CXXConstructorDecl
*Constructor,
return Invalid;
}
+bool Sema::isTypeAwareOperatorNewOrDelete(const NamedDecl *ND) const {
+ const FunctionDecl *FnDecl = nullptr;
+ if (auto *FTD = dyn_cast(ND))
+FnDecl = FT
@@ -2527,6 +2527,32 @@ class FunctionDecl : public DeclaratorDecl,
/// If this function is an allocation/deallocation function that takes
/// the `std::nothrow_t` tag, return true through IsNothrow,
bool isReplaceableGlobalAllocationFunction(
+ std::optional *Alignme
@@ -3849,7 +4119,15 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool
UseGlobal,
// delete. This is only necessary if we selected a destroying operator
// delete that we are going to call (non-virtually); converting to void*
// is trivial and left to AST consum
@@ -9817,27 +9817,54 @@ def err_operator_new_delete_invalid_result_type : Error<
def err_operator_new_delete_dependent_result_type : Error<
"%0 cannot have a dependent return type; use %1 instead">;
def err_operator_new_delete_too_few_parameters : Error<
- "%0 must have at l
@@ -9784,10 +9850,16 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD,
//results in an ambiguity or in a function that is deleted or
inaccessible
if (CSM == CXXSpecialMemberKind::Destructor && MD->isVirtual()) {
FunctionDecl *OperatorDelete = nullptr;
+
@@ -2520,6 +2520,18 @@ class FunctionDecl : public DeclaratorDecl,
/// If this function is an allocation/deallocation function that takes
/// the `std::nothrow_t` tag, return true through IsNothrow,
bool isReplaceableGlobalAllocationFunction(
+ std::optional *Alignme
@@ -2234,6 +2234,101 @@ enum class CXXNewInitializationStyle {
Braces
};
+enum class TypeAwareAllocationMode : unsigned { No, Yes };
+inline bool isTypeAwareAllocation(TypeAwareAllocationMode Mode) {
+ return Mode == TypeAwareAllocationMode::Yes;
+}
+inline TypeAwareAllocat
https://github.com/cor3ntin commented:
I think I have found all your comments that needed a follow-up :)
https://github.com/llvm/llvm-project/pull/113510
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/li
@@ -16223,6 +16324,70 @@ bool Sema::CompleteConstructorCall(CXXConstructorDecl
*Constructor,
return Invalid;
}
+bool Sema::isTypeAwareOperatorNewOrDelete(const NamedDecl *ND) const {
+ const FunctionDecl *FnDecl = nullptr;
cor3ntin wrote:
I don't think so
@@ -3503,9 +3518,23 @@ bool FunctionDecl::isDestroyingOperatorDelete() const {
getNumParams() < 2)
return false;
- auto *RD = getParamDecl(1)->getType()->getAsCXXRecordDecl();
- return RD && RD->isInStdNamespace() && RD->getIdentifier() &&
- RD->getIdentifi
https://github.com/cor3ntin commented:
> *[Reviewable](https://reviewable.io/reviews/llvm/llvm-project/113510)*
> status: 0 of 54 files reviewed, 119 unresolved discussions (waiting on
> @AaronBallman, @Bigcheese, @ChuanqiXu9, @efriedma-quic, @erichkeane,
> @mizvekov, @ogiroux, @ojhunt, @Sir
@@ -4778,6 +4784,16 @@ class Sema final : public SemaBase {
CXXRecordDecl *getStdBadAlloc() const;
EnumDecl *getStdAlignValT() const;
+ const ClassTemplateDecl *getStdTypeIdentity() const;
+ ClassTemplateDecl *getStdTypeIdentity();
+ std::optional instantiateSpecialized
@@ -2234,6 +2234,101 @@ enum class CXXNewInitializationStyle {
Braces
};
+enum class TypeAwareAllocationMode : unsigned { No, Yes };
+inline bool isTypeAwareAllocation(TypeAwareAllocationMode Mode) {
+ return Mode == TypeAwareAllocationMode::Yes;
+}
+inline TypeAwareAllocat
@@ -3482,15 +3486,40 @@ bool FunctionDecl::isDestroyingOperatorDelete() const {
// Within a class C, a single object deallocation function with signature
// (T, std::destroying_delete_t, )
// is a destroying operator delete.
- if (!isa(this) || getOverloadedOpera
@@ -3134,6 +3134,31 @@ bool Type::isStdByteType() const {
return false;
}
+bool Type::isDestroyingDeleteT() const {
+ auto *RD = getAsCXXRecordDecl();
+ return RD && RD->isInStdNamespace() && RD->getIdentifier() &&
+ RD->getIdentifier()->isStr("destroying_delete_t"
https://github.com/ojhunt commented:
> *[Reviewable](https://reviewable.io/reviews/llvm/llvm-project/113510)*
> status: 0 of 54 files reviewed, 119 unresolved discussions (waiting on
> @AaronBallman, @Bigcheese, @ChuanqiXu9, @cor3ntin, @efriedma-quic,
> @erichkeane, @mizvekov, @ogiroux, @Sir
https://github.com/ojhunt edited
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
@@ -4749,6 +4753,15 @@ class Sema final : public SemaBase {
CXXRecordDecl *getStdBadAlloc() const;
EnumDecl *getStdAlignValT() const;
+ ClassTemplateDecl *getStdTypeIdentity() const;
+ std::optional InstantiateSpecializedTypeIdentity(QualType Subject);
o
@@ -477,6 +477,44 @@ class DeclarationName {
return OO_None;
}
+ bool isOperatorNew() const {
+if (getNameKind() != DeclarationName::CXXOperatorName)
+ return false;
+switch (getCXXOverloadedOperator()) {
+case OO_New:
+case OO_Array_New:
+ ret
@@ -7256,6 +7257,71 @@ void Sema::CheckCompletedCXXClass(Scope *S,
CXXRecordDecl *Record) {
else if (Record->hasAttr())
checkCUDADeviceBuiltinTextureClassTemplate(*this, Record);
}
+
+ if (getLangOpts().TypeAwareAllocators) {
+llvm::SmallVector TypeAwareNewDec
@@ -3482,15 +3486,40 @@ bool FunctionDecl::isDestroyingOperatorDelete() const {
// Within a class C, a single object deallocation function with signature
// (T, std::destroying_delete_t, )
// is a destroying operator delete.
- if (!isa(this) || getOverloadedOpera
@@ -2533,9 +2533,43 @@ bool CXXMethodDecl::isUsualDeallocationFunction(
getOverloadedOperator() != OO_Array_Delete)
cor3ntin wrote:
We have a function for that now!
https://github.com/llvm/llvm-project/pull/113510
_
@@ -307,6 +307,10 @@ EXTENSION(datasizeof, LangOpts.CPlusPlus)
FEATURE(cxx_abi_relative_vtable, LangOpts.CPlusPlus &&
LangOpts.RelativeCXXABIVTables)
+// Type aware allocators
+FEATURE(cxx_type_aware_allocators, LangOpts.TypeAwareAllocators)
cor3ntin wrote:
@@ -3134,6 +3134,31 @@ bool Type::isStdByteType() const {
return false;
}
+bool Type::isDestroyingDeleteT() const {
+ auto *RD = getAsCXXRecordDecl();
+ return RD && RD->isInStdNamespace() && RD->getIdentifier() &&
+ RD->getIdentifier()->isStr("destroying_delete_t"
https://github.com/cor3ntin edited
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
1 - 100 of 197 matches
Mail list logo