ojhunt wrote:
I'm planning on removing the docs, but I've left them in for now just so that
reviewers can read them if they want context to understand the PR.
@cor3ntin @AaronBallman @erichkeane I'm ok removing the flag, I'll look into
how to diagnose the "you're using an extension/future lang
ojhunt wrote:
@cor3ntin @AaronBallman @erichkeane There is a bunch of super unpleasant
nonsense in the new and delete codegen paths, it would simplify things a lot if
we actually had the AST nodes actually be complete, e.g. the AST node would
include expression nodes for the implicit parameter
@@ -2850,6 +2850,26 @@ void CXXNameMangler::mangleQualifiers(Qualifiers Quals,
const DependentAddressSp
if (Quals.hasUnaligned())
mangleVendorQualifier("__unaligned");
+ // __ptrauth. Note that this is parameterized.
+ if (PointerAuthQualifier PtrAuth = Quals.getPoin
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -triple arm64-apple-ios -fsyntax-only -verify
-fptrauth-intrinsics -std=c++11 %s
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -fsyntax-only -verify
-fptrauth-intrinsics -std=c++11 %s
+
+template struct G {
+ T __ptrauth(0,0,1234) test;
+
@@ -4749,6 +4753,15 @@ class Sema final : public SemaBase {
CXXRecordDecl *getStdBadAlloc() const;
EnumDecl *getStdAlignValT() const;
+ ClassTemplateDecl *getStdTypeIdentity() const;
+ std::optional InstantiateSpecializedTypeIdentity(QualType Subject);
o
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
@@ -2474,19 +2474,46 @@ bool CXXMethodDecl::isUsualDeallocationFunction(
getOverloadedOperator() != OO_Array_Delete)
return false;
+ auto NumParams = getNumParams();
+ bool IsTypeAware = IsTypeAwareOperatorNewOrDelete();
+
// C++ [basic.stc.dynamic.deallocation]
@@ -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
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
@@ -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;
@@ -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
@@ -19001,9 +19001,9 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc,
Decl *EnclosingDecl,
// Verify that all the fields are okay.
SmallVector RecFields;
-
+ std::optional PreviousField;
ojhunt wrote:
@rnk this is sufficiently constrained/non-
@@ -631,6 +631,9 @@ Improvements to Clang's diagnostics
- Clang now diagnoses dangling references for C++20's parenthesized aggregate
initialization (#101957).
+- A new off-by-default warning ``-Wms-bitfield-compatibility`` has been added
to alert to cases where bit-field
-
@@ -631,6 +631,7 @@ def Packed : DiagGroup<"packed", [PackedNonPod]>;
def PaddedBitField : DiagGroup<"padded-bitfield">;
def Padded : DiagGroup<"padded", [PaddedBitField]>;
def UnalignedAccess : DiagGroup<"unaligned-access">;
+def MSBitfieldCompatibility : DiagGroup<"ms-bitfiel
@@ -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
@@ -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
ojhunt wrote:
No one commented on this test case, but for the record:
* It runs in both ms_bitfields and sane (:D) mode
* The static assertions are used to force struct layout
* We assert the structs are the same size or different sizes depending on
layout mod
@@ -6404,20 +6404,23 @@ def warn_bitfield_width_exceeds_type_width: Warning<
def err_bitfield_too_wide : Error<
"%select{bit-field %1|anonymous bit-field}0 is too wide (%2 bits)">;
def warn_bitfield_too_small_for_enum : Warning<
- "bit-field %0 is not wide enough to store al
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -6517,8 +6517,22 @@ def warn_signed_bitfield_enum_conversion : Warning<
"signed bit-field %0 needs an extra bit to represent the largest positive "
"enumerators of %1">,
InGroup, DefaultIgnore;
+def warn_preferred_type_bitfield_too_small_for_enum : Warning<
+ "bit-fie
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
@@ -2627,16 +2731,21 @@ static bool resolveAllocationOverload(
// FIXME: Find out how this interacts with the std::align_val_t fallback
// once MSVC implements it.
if (R.getLookupName().getCXXOverloadedOperator() == OO_Array_New &&
-S.Context.getLangOpts().M
@@ -16327,79 +16531,181 @@ static CanQualType RemoveAddressSpaceFromPtr(Sema
&SemaRef,
PtrTy->getPointeeType().getUnqualifiedType(), PtrQuals)));
}
-static inline bool
-CheckOperatorNewDeleteTypes(Sema &SemaRef, const FunctionDecl *FnDecl,
-C
@@ -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)
@@ -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
@@ -16335,22 +16550,27 @@ CheckOperatorNewDeclaration(Sema &SemaRef, const
FunctionDecl *FnDecl) {
CanQualType SizeTy =
SemaRef.Context.getCanonicalType(SemaRef.Context.getSizeType());
+ unsigned MinimumNonDefaultArgs = 0;
// C++ [basic.stc.dynamic.allocation]p1:
@@ -477,6 +477,34 @@ class DeclarationName {
return OO_None;
}
+ bool isAnyOperatorNew() const {
+if (getNameKind() != DeclarationName::CXXOperatorName)
+ return false;
+switch (getCXXOverloadedOperator()) {
+case OO_New:
+case OO_Array_New:
+
@@ -2709,14 +2831,63 @@ static bool resolveAllocationOverload(
llvm_unreachable("Unreachable, bad result from BestViableFunction");
}
-bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range,
- AllocationFunctionScope N
@@ -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
@@ -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.
@@ -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
- //
@@ -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
@@ -7353,6 +7354,69 @@ void Sema::CheckCompletedCXXClass(Scope *S,
CXXRecordDecl *Record) {
else if (Record->hasAttr())
checkCUDADeviceBuiltinTextureClassTemplate(*this, Record);
}
+
+ llvm::SmallVector TypeAwareNewDecls;
+ llvm::SmallVector TypeAwareDeleteDecls;
@@ -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.
@@ -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) {
+
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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) {
+
@@ -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
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
@@ -2474,19 +2474,46 @@ bool CXXMethodDecl::isUsualDeallocationFunction(
getOverloadedOperator() != OO_Array_Delete)
return false;
+ auto NumParams = getNumParams();
+ bool IsTypeAware = IsTypeAwareOperatorNewOrDelete();
+
// C++ [basic.stc.dynamic.deallocation]
@@ -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
@@ -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
@@ -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
_
@@ -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<
@@ -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;
@@ -0,0 +1,180 @@
+
+// RUN: %clang_cc1 -fsyntax-only -Wms-bitfield-compatibility -verify -triple
armv8 -std=c++23 %s
+// RUN: %clang_cc1 -fsyntax-only -DMS_BITFIELDS -mms-bitfields
-verify=msbitfields -triple armv8-apple-macos10.15 -std=c++23 %s
+
+// msbitfields-no-diagnostics
ojhunt wrote:
(Finally getting back to this one)
https://github.com/llvm/llvm-project/pull/117428
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/ojhunt updated
https://github.com/llvm/llvm-project/pull/117428
>From 3e25d7ef2e223942298078dace8979905956d05c Mon Sep 17 00:00:00 2001
From: Oliver Hunt
Date: Fri, 22 Nov 2024 17:53:24 +0100
Subject: [PATCH 01/10] Add an off-by-default warning to complain about MSVC
bitfiel
@@ -633,6 +633,52 @@ def Packed : DiagGroup<"packed", [PackedNonPod]>;
def PaddedBitField : DiagGroup<"padded-bitfield">;
def Padded : DiagGroup<"padded", [PaddedBitField]>;
def UnalignedAccess : DiagGroup<"unaligned-access">;
+def MSBitfieldCompatibility : DiagGroup<"ms-bitfie
@@ -6519,6 +6519,13 @@ def warn_signed_bitfield_enum_conversion : Warning<
InGroup, DefaultIgnore;
def note_change_bitfield_sign : Note<
"consider making the bit-field type %select{unsigned|signed}0">;
+def warn_ms_bitfield_mismatched_storage_packing : Warning<
+ "bit-fiel
https://github.com/ojhunt updated
https://github.com/llvm/llvm-project/pull/116785
>From 5f260726253e78a00d2dff02c22837ce02b49075 Mon Sep 17 00:00:00 2001
From: Oliver Hunt
Date: Tue, 19 Nov 2024 11:55:11 +0100
Subject: [PATCH 1/6] [Clang] Consider preferred_type in bitfield warnings
(#116760)
@@ -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
@@ -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
@@ -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"
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 __
@@ -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
@@ -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
@@ -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
https://github.com/ojhunt requested changes to this pull request.
https://github.com/llvm/llvm-project/pull/132284
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -10509,14 +10516,18 @@ static bool AnalyzeBitFieldAssignment(Sema &S,
FieldDecl *Bitfield, Expr *Init,
ED->getNumPositiveBits() == FieldWidth) {
DiagID = diag::warn_signed_bitfield_enum_conversion;
}
-
+ unsigned PreferredTypeDiagIndex =
@@ -6418,6 +6418,12 @@ def warn_signed_bitfield_enum_conversion : Warning<
InGroup, DefaultIgnore;
def note_change_bitfield_sign : Note<
"consider making the bitfield type %select{unsigned|signed}0">;
+def warn_ms_bitfield_mismatched_storage_packing : Warning<
+ "bit-field
@@ -6404,20 +6404,23 @@ def warn_bitfield_width_exceeds_type_width: Warning<
def err_bitfield_too_wide : Error<
"%select{bit-field %1|anonymous bit-field}0 is too wide (%2 bits)">;
def warn_bitfield_too_small_for_enum : Warning<
- "bit-field %0 is not wide enough to store al
@@ -6418,6 +6418,12 @@ def warn_signed_bitfield_enum_conversion : Warning<
InGroup, DefaultIgnore;
def note_change_bitfield_sign : Note<
"consider making the bitfield type %select{unsigned|signed}0">;
+def warn_ms_bitfield_mismatched_storage_packing : Warning<
+ "bit-field
@@ -633,6 +633,50 @@ def Packed : DiagGroup<"packed", [PackedNonPod]>;
def PaddedBitField : DiagGroup<"padded-bitfield">;
def Padded : DiagGroup<"padded", [PaddedBitField]>;
def UnalignedAccess : DiagGroup<"unaligned-access">;
+def MSBitfieldCompatibility : DiagGroup<"ms-bitfie
@@ -0,0 +1,113 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fsyntax-only
-verify=expected,preferrednotes -std=c11 -Wno-unused-value
-Wno-unused-but-set-variable
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fsyntax-only
-verify=expected,bitfieldwarning,prefe
@@ -0,0 +1,180 @@
+
+// RUN: %clang_cc1 -fsyntax-only -Wms-bitfield-compatibility -verify -triple
armv8 -std=c++23 %s
+// RUN: %clang_cc1 -fsyntax-only -DMS_BITFIELDS -mms-bitfields
-verify=msbitfields -triple armv8-apple-macos10.15 -std=c++23 %s
+
+// msbitfields-no-diagnostics
@@ -6418,6 +6418,12 @@ def warn_signed_bitfield_enum_conversion : Warning<
InGroup, DefaultIgnore;
def note_change_bitfield_sign : Note<
"consider making the bitfield type %select{unsigned|signed}0">;
+def warn_ms_bitfield_mismatched_storage_packing : Warning<
+ "bit-field
@@ -6404,20 +6404,23 @@ def warn_bitfield_width_exceeds_type_width: Warning<
def err_bitfield_too_wide : Error<
"%select{bit-field %1|anonymous bit-field}0 is too wide (%2 bits)">;
def warn_bitfield_too_small_for_enum : Warning<
- "bit-field %0 is not wide enough to store al
@@ -10488,7 +10488,14 @@ static bool AnalyzeBitFieldAssignment(Sema &S,
FieldDecl *Bitfield, Expr *Init,
// The RHS is not constant. If the RHS has an enum type, make sure the
// bitfield is wide enough to hold all the values of the enum without
// truncation.
-
@@ -6408,20 +6408,24 @@ def warn_bitfield_width_exceeds_type_width: Warning<
def err_bitfield_too_wide : Error<
"%select{bit-field %1|anonymous bit-field}0 is too wide (%2 bits)">;
def warn_bitfield_too_small_for_enum : Warning<
- "bit-field %0 is not wide enough to store al
@@ -6408,20 +6408,24 @@ def warn_bitfield_width_exceeds_type_width: Warning<
def err_bitfield_too_wide : Error<
"%select{bit-field %1|anonymous bit-field}0 is too wide (%2 bits)">;
def warn_bitfield_too_small_for_enum : Warning<
- "bit-field %0 is not wide enough to store al
@@ -0,0 +1,113 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fsyntax-only
-verify=expected,preferrednotes -std=c11 -Wno-unused-value
-Wno-unused-but-set-variable
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fsyntax-only
-verify=expected,bitfieldwarning,prefe
@@ -6408,20 +6408,24 @@ def warn_bitfield_width_exceeds_type_width: Warning<
def err_bitfield_too_wide : Error<
"%select{bit-field %1|anonymous bit-field}0 is too wide (%2 bits)">;
def warn_bitfield_too_small_for_enum : Warning<
- "bit-field %0 is not wide enough to store al
@@ -19213,6 +19213,29 @@ void Sema::ActOnFields(Scope *S, SourceLocation
RecLoc, Decl *EnclosingDecl,
if (Record && FD->getType().isVolatileQualified())
Record->setHasVolatileMember(true);
+auto IsNonDependentBitField = [](const FieldDecl *FD) {
+ if (!FD->
101 - 200 of 352 matches
Mail list logo