[clang] Add an off-by-default warning to complain about MSVC bitfield padding (PR #117428)

2025-03-25 Thread Oliver Hunt via cfe-commits
@@ -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

[clang] [clang] Fix crash on invalid `std::initializer_list` template-id (PR #132284)

2025-03-25 Thread Oliver Hunt via cfe-commits
@@ -12182,10 +12182,14 @@ QualType Sema::BuildStdInitializerList(QualType Element, SourceLocation Loc) { Args.addArgument(TemplateArgumentLoc(TemplateArgument(Element), Context.getTrivialTypeSourceInfo(Element,

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

2025-03-24 Thread Oliver Hunt via cfe-commits
@@ -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"

[clang] [Clang] Consider preferred_type in bitfield warnings (#116760) (PR #116785)

2025-04-04 Thread Oliver Hunt via cfe-commits
@@ -10601,19 +10608,28 @@ static bool AnalyzeBitFieldAssignment(Sema &S, FieldDecl *Bitfield, Expr *Init, // on Windows where unfixed enums always use an underlying type of 'int'. unsigned DiagID = 0; if (SignedEnum && !SignedBitfield) { -DiagID = dia

[clang] [clang] Add builtin_get_vtable_pointer and virtual_member_address (PR #135469)

2025-04-13 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/135469 >From 1607a76c4fd2bd7f0c4e834d2935668d51daf55f Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Sun, 13 Apr 2025 00:47:18 -0700 Subject: [PATCH] [clang] Add builtin_get_vtable_pointer and virtual_member_address

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

2025-04-14 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @Sterling-Augustine thank you! 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

[clang] [Clang]Ensure correct handling of cleanup access control (#135668) (PR #135686)

2025-04-14 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/135686 >From 62be33b3aa475a33d1c11679ed069eb2af981754 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Mon, 14 Apr 2025 15:02:46 -0700 Subject: [PATCH] [Clang]Ensure correct handling of access control in P2719 diagnost

[clang] [Clang]Ensure correct handling of cleanup access control (#135668) (PR #135686)

2025-04-14 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > Thanks for the quick fix it's so very very stupid :O https://github.com/llvm/llvm-project/pull/135686 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-04-14 Thread Oliver Hunt via cfe-commits
ojhunt wrote: I have a very immediate fix, but I'd rather a slightly nicer one - at some point refactoring exposed a problem in access control diagnostics, in a way that is very very weird and implies something else broken in the existing tree as well. If I can't work out the correct systemic

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

2025-04-14 Thread Oliver Hunt via cfe-commits
ojhunt wrote: https://github.com/llvm/llvm-project/pull/135686 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

[clang] [Clang]Ensure correct handling of cleanup access control (#135668) (PR #135686)

2025-04-14 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @Sterling-Augustine sorry I was waiting for all the bots to pass https://github.com/llvm/llvm-project/pull/135686 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang]Ensure correct handling of cleanup access control (#135668) (PR #135686)

2025-04-14 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/135686 >From 62be33b3aa475a33d1c11679ed069eb2af981754 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Mon, 14 Apr 2025 15:02:46 -0700 Subject: [PATCH] [Clang]Ensure correct handling of access control in P2719 diagnost

[clang] [Clang] Consider preferred_type in bitfield warnings (#116760) (PR #116785)

2025-04-20 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Waiting on review for https://github.com/llvm/llvm-project/pull/136515 https://github.com/llvm/llvm-project/pull/116785 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Ensure bit-fields storing FPEvalMethodKind are wide enough to do so (PR #136515)

2025-04-20 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/136515 After landing #116760 we hit build failures due to existing fields storing FPEvalMethodKind not being wide enough. >From 535e11400ea11461fa8e0cc98f9b481b045805c4 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date:

[clang] Ensure bit-fields storing FPEvalMethodKind are wide enough to do so (PR #136515)

2025-04-20 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt closed https://github.com/llvm/llvm-project/pull/136515 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Ensure bit-fields storing FPEvalMethodKind are wide enough to do so (PR #136515)

2025-04-20 Thread Oliver Hunt via cfe-commits
ojhunt wrote: This is a blind build fix, so I'll merge https://github.com/llvm/llvm-project/pull/136515 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Consider preferred_type in bitfield warnings (#116760) (PR #116785)

2025-04-20 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt closed https://github.com/llvm/llvm-project/pull/116785 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ptrauth] Make ptrauth feature detection tests more robust (PR #136204)

2025-04-17 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt closed https://github.com/llvm/llvm-project/pull/136204 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add builtin_get_vtable_pointer and virtual_member_address (PR #135469)

2025-04-17 Thread Oliver Hunt via cfe-commits
@@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -triple arm64e-apple-ios -fptrauth-calls -emit-llvm -no-enable-noundef-analysis -o - %s | FileCheck %s --check-prefixes CHECK,CHECK-AUTH +// RUN: %clang_cc1 -triple arm64-apple-ios -emit-llvm -no-enable-noundef-analysis -o - %s | FileCheck %

[clang] [clang][ptrauth] Make ptrauth feature detection tests more robust (PR #136204)

2025-04-17 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/136204 The existing test behavior checked for a warning being emitted under an #if, but if the feature detection fails the #if fails and the warning is not expected in the output. I've made the test more explicit, and

[clang] [lldb] [clang] Add `__ptrauth_restricted_intptr` qualifier (PR #137580)

2025-04-27 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/137580 >From 0129e28643f667febb23dba1521134a6151c2f7d Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Sun, 27 Apr 2025 22:33:44 -0700 Subject: [PATCH] [clang] Add `__ptrauth_restricted_intptr` qualifier __ptrauth_rest

[clang] [clang] Fix and test triviality of __ptrauth types (PR #137474)

2025-04-27 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Thanks! https://github.com/llvm/llvm-project/pull/137474 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix and test triviality of __ptrauth types (PR #137474)

2025-04-27 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt closed https://github.com/llvm/llvm-project/pull/137474 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Remove FEM_Indeterminable (PR #137247)

2025-04-28 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt closed https://github.com/llvm/llvm-project/pull/137247 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Remove FEM_Indeterminable (PR #137247)

2025-04-28 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @zahiraam it's currently causing a warning (@Endilll asking for an update is why I ended up looking at this on my phone) https://github.com/llvm/llvm-project/pull/137247 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lis

[clang] [clang] Remove FEM_Indeterminable (PR #137661)

2025-04-28 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/137661 Remove FEM_Indeterminable as it is unused and cannot be stored safely in an unsigned bitfield >From a33b76cb769b8669922101c9cb7b9fbb28cbb1fe Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Thu, 24 Apr 2025 13:

[clang] [clang] Remove FEM_Indeterminable (PR #137661)

2025-04-28 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @Endilll this is the fix for the warning you're seeing https://github.com/llvm/llvm-project/pull/137661 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Remove FEM_Indeterminable (PR #137661)

2025-04-28 Thread Oliver Hunt via cfe-commits
ojhunt wrote: (Recreating after mismerge) https://github.com/llvm/llvm-project/pull/137661 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Remove FEM_Indeterminable (PR #137247)

2025-04-28 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Hmmm, I thought it had been? https://github.com/llvm/llvm-project/pull/137247 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Remove FEM_Indeterminable (PR #137247)

2025-04-28 Thread Oliver Hunt via cfe-commits
ojhunt wrote: I've reverted, not sure why I thought it had been reviewed? https://github.com/llvm/llvm-project/pull/137247 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "[clang] Remove FEM_Indeterminable" (PR #137654)

2025-04-28 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/137654 Reverts llvm/llvm-project#137247 >From 8da1b21e8c45980741fc6f5d8f290ac9ac80d878 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Mon, 28 Apr 2025 08:50:35 -0700 Subject: [PATCH] Revert "[clang] Remove FEM_Indete

[clang] Revert "[clang] Remove FEM_Indeterminable" (PR #137654)

2025-04-28 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt closed https://github.com/llvm/llvm-project/pull/137654 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Remove FEM_Indeterminable (PR #137661)

2025-04-28 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @zahiraam we started diagnosing size/type mismatch of bitfields vs preferred_type in, which exposed that FPEvalMethodKind based options can't store FEM_Indeterminable https://github.com/llvm/llvm-project/pull/116785 https://github.com/llvm/llvm-project/pull/137661 ___

[clang] [clang] Remove FEM_Indeterminable (PR #137661)

2025-04-28 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @zahiraam @AaronBallman a different option would be to add a signed vs unsigned storage option to the `OPTION` and `BENIGN_ENUM_LANGOPT` macros so we can store negative enumerations safely https://github.com/llvm/llvm-project/pull/137661 __

[clang] [clang] Fix and test triviality of __ptrauth types (PR #137474)

2025-04-27 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt approved this pull request. Good catch, we'll need to add cases to the test when pushing __ptrauth_restricted_intptr https://github.com/llvm/llvm-project/pull/137474 ___ cfe-commits mailing list cfe-commits@lists.llvm.org ht

[clang] [clang] Ensure correct copying of records with authenticated fields (PR #136783)

2025-04-22 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/136783 When records contain fields with pointer authentication, even simple copies can require additional work be performed. This patch contains the core functionality required to handle user defined structs, as well a

[clang] [clang] Ensure correct copying of records with authenticated fields (PR #136783)

2025-04-23 Thread Oliver Hunt via cfe-commits
@@ -2801,6 +2801,10 @@ static bool isTriviallyCopyableTypeImpl(const QualType &type, if (type.hasNonTrivialObjCLifetime()) return false; + QualType::PrimitiveCopyKind PCK = type.isNonTrivialToPrimitiveCopy(); + if (PCK != QualType::PCK_Trivial && PCK != QualType::PCK_

[clang] [clang] Ensure correct copying of records with authenticated fields (PR #136783)

2025-04-24 Thread Oliver Hunt via cfe-commits
@@ -103,3 +103,46 @@ static_assert(_Generic(typeof(overload_func(&ptr0)), int : 1, default : 0)); static_assert(_Generic(typeof(overload_func(&valid0)), float : 1, default : 0)); void func(int array[__ptrauth(VALID_DATA_KEY) 10]); // expected-error {{'__ptrauth' qualifier o

[clang] [Clang] Consider preferred_type in bitfield warnings (#116760) (PR #116785)

2025-04-24 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > This change makes Clang produce warnings when building Clang itself; warnings > looking like this: > That was the entire point of this warning. As far as I know clang+llvm is the only project to use preferred_type (instead of just using enum typed bitfields), but as a result

[clang] [clang] Ensure correct copying of records with authenticated fields (PR #136783)

2025-04-24 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt closed https://github.com/llvm/llvm-project/pull/136783 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-23 Thread Oliver Hunt via cfe-commits
@@ -8374,20 +8376,212 @@ static void HandlePtrAuthQualifier(ASTContext &Ctx, QualType &T, IsInvalid |= !S.checkPointerAuthDiscriminatorArg( ExtraDiscriminatorArg, Sema::PADAK_ExtraDiscPtrAuth, ExtraDiscriminator); - if (IsInvalid) { -Attr.setInvalid(); -retur

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-23 Thread Oliver Hunt via cfe-commits
@@ -8374,20 +8376,212 @@ static void HandlePtrAuthQualifier(ASTContext &Ctx, QualType &T, IsInvalid |= !S.checkPointerAuthDiscriminatorArg( ExtraDiscriminatorArg, Sema::PADAK_ExtraDiscPtrAuth, ExtraDiscriminator); - if (IsInvalid) { -Attr.setInvalid(); -retur

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-23 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @cor3ntin the option selection down stream is a StringSwitch on the authentication mode, and then a sequence of (not large, I think just two) `if (option == constant)` checks to set up specific options. Previous PRs have suggested maps, etc for such conditions, and a map of opti

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-23 Thread Oliver Hunt via cfe-commits
@@ -8374,20 +8376,212 @@ static void HandlePtrAuthQualifier(ASTContext &Ctx, QualType &T, IsInvalid |= !S.checkPointerAuthDiscriminatorArg( ExtraDiscriminatorArg, Sema::PADAK_ExtraDiscPtrAuth, ExtraDiscriminator); - if (IsInvalid) { -Attr.setInvalid(); -retur

[clang] [clang] Remove FEM_Indeterminable (PR #137661)

2025-04-30 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @zahiraam none of these actually try to set FEM_Indeterminate, so far I cannot find any way to make clang ever set that state and I can’t find a way for source code to do so either - it looks like in the past the fpcontrol pragma could induce it, but none of the examples still do

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-30 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/136828 >From b3de41c15edc527154e461e5b0df61642599b45e Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 23 Apr 2025 01:43:00 -0700 Subject: [PATCH 1/6] [clang][ptrauth] add support for options parameter to __ptraut

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-30 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/136828 >From 21dc6e5a5c9762292bc135c62c6b442dc18908b3 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 30 Apr 2025 22:26:59 -0700 Subject: [PATCH] [clang][ptrauth] add support for options parameter to __ptrauth T

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-30 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/136828 >From f5b7cf409e3518f79ac6fce5d01876a51ae6f4e2 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 30 Apr 2025 22:26:59 -0700 Subject: [PATCH] [clang][ptrauth] add support for options parameter to __ptrauth T

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-30 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/136828 >From d32a1bd141a668a2d8e8c6315a38506c7e1be4c7 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 30 Apr 2025 22:26:59 -0700 Subject: [PATCH] [clang][ptrauth] add support for options parameter to __ptrauth T

[clang] [clang] Remove FEM_Indeterminable (PR #137661)

2025-04-30 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Yeah, clang-15 seems to be the only time we would ever produce -1: https://godbolt.org/z/7M61eff4f https://github.com/llvm/llvm-project/pull/137661 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

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

2025-04-10 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt closed 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

[clang] [PAC] Add support for __ptrauth type qualifier (PR #100830)

2025-04-13 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @AaronBallman do you have any further requests or changes for this PR? https://github.com/llvm/llvm-project/pull/100830 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add an off-by-default warning to complain about MSVC bitfield padding (PR #117428)

2025-04-13 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @AaronBallman are you ok with this now? I'm re-requesting the review as it's been a while, and I want to confirm I addressed things as you wanted https://github.com/llvm/llvm-project/pull/117428 ___ cfe-commits mailing list cfe-commits@l

[clang] [clang] Add builtin_get_vtable_pointer and virtual_member_address (PR #135469)

2025-04-13 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > > I just noticed there's no documentation for > > `__builtin_virtual_member_address()` so I'm addressing that. > > Due to code drift and time I realized that they disagree as to whether they > > should take `C*` or `C&` so I'm going to make them both accept either > > (existing

[clang] [clang] Add builtin_get_vtable_pointer and virtual_member_address (PR #135469)

2025-04-13 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > > I just noticed there's no documentation for > > `__builtin_virtual_member_address()` so I'm addressing that. > > Due to code drift and time I realized that they disagree as to whether they > > should take `C*` or `C&` so I'm going to make them both accept either > > (existing

[clang] [clang][CGObjC] Sign the v-table pointer in ObjC exception RTTI. (PR #135562)

2025-04-13 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/135562 If clang is configured to apply pointer authentication to type_info's vtable pointer we ensure that the selected schema is applied to the RTTI objects generated for objc++. >From 5dc1e5fbb57f88e412e044605d8fe30

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

2025-04-14 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > We have tracked down a new and spurious "This variable is used uninitialized" > to this PR. I'm working on a reduced test case now. It looks like this: > > ``` > .cpp:XXX+2:13: error: variable 'new_section' is uninitialized when > used here [-Werror,-Wuninitialized] > 572 |

[clang] [clang] Add builtin_get_vtable_pointer and virtual_member_address (PR #135469)

2025-04-14 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > I'm confused -- how is there existing code depending on a builtin which > doesn't yet exist in Clang? Are we copying these builtins from somewhere else? This is part of the pointer authentication support we are upstreaming, all of which has been in use for a long time, just not

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

2025-04-14 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > We have tracked down a new and spurious "This variable is used uninitialized" > to this PR. I'm working on a reduced test case now. It looks like this: > > ``` > .cpp:XXX+2:13: error: variable 'new_section' is uninitialized when > used here [-Werror,-Wuninitialized] > 572 |

[clang] [Clang] Consider preferred_type in bitfield warnings (#116760) (PR #116785)

2025-04-12 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt edited https://github.com/llvm/llvm-project/pull/116785 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Add builtin_get_vtable_pointer and virtual_member_address (PR #135469)

2025-04-11 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/135469 These are a pair of builtins to support particularly weird edge case operations while correctly handling the non-trivial implicit pointer authentication schemas applied to polymorphic members. >From 6e1d13805da

[clang] [clang] Add builtin_get_vtable_pointer and virtual_member_address (PR #135469)

2025-04-11 Thread Oliver Hunt via cfe-commits
@@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -triple arm64e-apple-ios -fptrauth-calls -emit-llvm -no-enable-noundef-analysis -o - %s | FileCheck %s --check-prefixes CHECK,CHECK-AUTH +// RUN: %clang_cc1 -triple arm64-apple-ios -emit-llvm -no-enable-noundef-analysis -o - %s | FileCheck %

[clang] [clang] Add builtin_get_vtable_pointer and virtual_member_address (PR #135469)

2025-04-11 Thread Oliver Hunt via cfe-commits
ojhunt wrote: I just noticed there's no documentation for `__builtin_virtual_member_address()` so I'm addressing that. Due to code drift and time I realized that they disagree as to whether they should take `C*` or `C&` so I'm going to make them both accept either (existing code means we can'

[clang] [clang][ptrauth] Add support for querying the ptrauth schema of a type (PR #138482)

2025-05-04 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/138482 This adds a number of builtins to query the ptrauth schema of an arbitrary type in a way that can be fed into other ptrauth qualifiers. >From e84310f8a57a3f9b75dfc7260137e984d7f55f87 Mon Sep 17 00:00:00 2001 Fro

[clang] [clang][ptrauth] Add support for querying the ptrauth schema of a type (PR #138482)

2025-05-04 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Adding @cor3ntin and @AaronBallman in case they have a better idea for getting the function key to Sema than having it duplicated in langopts and codegen options https://github.com/llvm/llvm-project/pull/138482 ___ cfe-commits mailing l

[clang] [clang][ptrauth] Add support for querying the ptrauth schema of a type (PR #138482)

2025-05-04 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Also the associated tests do not pass yet as they're blocked on https://github.com/llvm/llvm-project/pull/136828 and other ptrauth PRs https://github.com/llvm/llvm-project/pull/138482 ___ cfe-commits mailing list cfe-commits@lists.llvm.o

[clang] [clang] Ensure type aware allocators handle transparent decl contexts (PR #138616)

2025-05-05 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/138616 >From b12d78087c521d61f3e078d5a0d79889b17fbde9 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Mon, 5 May 2025 16:17:15 -0700 Subject: [PATCH 1/2] [clang] Ensure type aware allocators handle transparent decl co

[clang] [clang] Ensure type aware allocators handle transparent decl contexts (PR #138616)

2025-05-05 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > Can you add tests? Thanks sigh, I thought I had :D please hold https://github.com/llvm/llvm-project/pull/138616 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Ensure type aware allocators handle transparent decl contexts (PR #138616)

2025-05-05 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt closed https://github.com/llvm/llvm-project/pull/138616 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Remove FEM_Indeterminable (PR #137661)

2025-04-30 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @AaronBallman @zahiraam given we do not support FEM_Indeterminate, and there appears to be no way to actually get clang into the state anyway, I think that the correct thing to do is to remove it and work out had to get this to cooperate with the OPTION macro if we ever do add s

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-30 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/136828 >From b3de41c15edc527154e461e5b0df61642599b45e Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 23 Apr 2025 01:43:00 -0700 Subject: [PATCH 1/5] [clang][ptrauth] add support for options parameter to __ptraut

[clang] [clang] Remove FEM_Indeterminable (PR #137661)

2025-05-02 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/137661 >From a52df39baea119a5a7b13dd8d98dd145522f6293 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Thu, 24 Apr 2025 13:30:40 -0700 Subject: [PATCH 1/2] [clang] Remove FEM_Indeterminable Remove FEM_Indeterminable as

[clang] [clang] Remove FEM_Indeterminable (PR #137661)

2025-05-02 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Two of the fixes were to code that was removed while resolving the merge conflict on the LANG_OPT declaration, I thought with the revert of c2a62af I got all the changes but I'll recheck https://github.com/llvm/llvm-project/pull/137661

[clang] [clang] Remove FEM_Indeterminable (PR #137661)

2025-05-02 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Just waiting on a build (force push was due to me hopelessly screwing up my tree) https://github.com/llvm/llvm-project/pull/137661 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[clang] [clang] Remove FEM_Indeterminable (PR #137661)

2025-05-02 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt closed https://github.com/llvm/llvm-project/pull/137661 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Remove FEM_Indeterminable (PR #137661)

2025-05-02 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > @ojhunt In #137600 there are a list of a few temporary PRs that were merged > in to silence the warning. These need to be reverted after this one gets > merged in. Do you want to revert them or you want me to do that? I removed them as part of resolving the merge conflict, and

[clang] [clang] Complete the revert of 1a14ef1 (PR #138341)

2025-05-02 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/138341 When merging the fix for FEM_Indeterminate I reverted the follow on warning fixes, but misread this diff and retained the explicitly defaulted constructor. >From f8a05ddf95c4efa963411694f49fa235e59c3d5c Mon Sep

[clang] [clang] Complete the revert of 1a14ef1 (PR #138341)

2025-05-02 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @zahiraam missed this while reverting :-O https://github.com/llvm/llvm-project/pull/138341 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Complete the revert of 1a14ef1 (PR #138341)

2025-05-02 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt closed https://github.com/llvm/llvm-project/pull/138341 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-05-04 Thread Oliver Hunt via cfe-commits
@@ -8374,20 +8376,212 @@ static void HandlePtrAuthQualifier(ASTContext &Ctx, QualType &T, IsInvalid |= !S.checkPointerAuthDiscriminatorArg( ExtraDiscriminatorArg, Sema::PADAK_ExtraDiscPtrAuth, ExtraDiscriminator); - if (IsInvalid) { -Attr.setInvalid(); -retur

[clang] [clang] Ensure type aware allocators handle transparent decl contexts (PR #138616)

2025-05-05 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/138616 We were testing the immediate DeclContext for found new and delete operators, which is incorrect if the declarations are contained by a transparent decl as can be induced with extern or export statements.

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-23 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/136828 This PR adds support for an 'options' parameter for the __ptrauth qualifier. The initial version only exposes the authehntication modes: * "strip" * "sign-and-strip" * "sign-and-auth" There are other options

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-23 Thread Oliver Hunt via cfe-commits
ojhunt wrote: The tests in this PR are dependent on #136828, and the included tests have non-sequential numbers as the tests include other options that are not supported by this PR, to try and limit the complexity of this PR to just the parsing and existing functionality. https://github.com/l

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-23 Thread Oliver Hunt via cfe-commits
@@ -8374,20 +8376,191 @@ static void HandlePtrAuthQualifier(ASTContext &Ctx, QualType &T, IsInvalid |= !S.checkPointerAuthDiscriminatorArg( ExtraDiscriminatorArg, Sema::PADAK_ExtraDiscPtrAuth, ExtraDiscriminator); - if (IsInvalid) { -Attr.setInvalid(); -retur

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-23 Thread Oliver Hunt via cfe-commits
@@ -8374,20 +8376,191 @@ static void HandlePtrAuthQualifier(ASTContext &Ctx, QualType &T, IsInvalid |= !S.checkPointerAuthDiscriminatorArg( ExtraDiscriminatorArg, Sema::PADAK_ExtraDiscPtrAuth, ExtraDiscriminator); - if (IsInvalid) { -Attr.setInvalid(); -retur

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-23 Thread Oliver Hunt via cfe-commits
@@ -8374,20 +8376,191 @@ static void HandlePtrAuthQualifier(ASTContext &Ctx, QualType &T, IsInvalid |= !S.checkPointerAuthDiscriminatorArg( ExtraDiscriminatorArg, Sema::PADAK_ExtraDiscPtrAuth, ExtraDiscriminator); - if (IsInvalid) { -Attr.setInvalid(); -retur

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-23 Thread Oliver Hunt via cfe-commits
ojhunt wrote: This PR is a draft as it will need to be updated to merged correctly, and verify test output (conflicts, unintentional mismatches coming from splitting out the PR) after #136828 https://github.com/llvm/llvm-project/pull/136828 ___ cfe-c

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-23 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/136828 >From b3de41c15edc527154e461e5b0df61642599b45e Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 23 Apr 2025 01:43:00 -0700 Subject: [PATCH 1/2] [clang][ptrauth] add support for options parameter to __ptraut

[clang] [clang][ptrauth] add support for options parameter to __ptrauth (PR #136828)

2025-04-23 Thread Oliver Hunt via cfe-commits
@@ -8350,14 +8350,16 @@ static void HandleNeonVectorTypeAttr(QualType &CurType, const ParsedAttr &Attr, /// Handle the __ptrauth qualifier. static void HandlePtrAuthQualifier(ASTContext &Ctx, QualType &T, const ParsedAttr &Attr, Sema &S) { -

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

2025-04-23 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > We have tracked two more issues to this commit. Both only manifest when using > Clang header modules, which likely means that AST serialization is somehow > incorrect after this patch. I'm reducing one of the test cases now, but it's > taking a lot of time. In the meantime, ple

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

2025-04-23 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > We have tracked two more issues to this commit. Both only manifest when using > Clang header modules, which likely means that AST serialization is somehow > incorrect after this patch. I'm reducing one of the test cases now, but it's > taking a lot of time. In the meantime, ple

[clang] [clang][p2719] Module deserialization does not restore allocator flags (PR #137102)

2025-04-23 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt ready_for_review https://github.com/llvm/llvm-project/pull/137102 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][p2719] Module deserialization does not restore allocator flags (PR #137102)

2025-04-23 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/137102 >From dec6509a54940fdda77577c9d07e1c061701ab75 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 23 Apr 2025 18:09:22 -0700 Subject: [PATCH] [clang][p2719] Module deserialization does not restore allocator f

[clang] [clang][p2719] Module deserialization does not restore allocator flags (PR #137102)

2025-04-23 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Ok, added PCH and module tests - verified both tests fail without this fix to the serialization, and they pass now. https://github.com/llvm/llvm-project/pull/137102 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.ll

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

2025-04-23 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @alexfh yeah I think I found the issue, would you mind trying https://github.com/llvm/llvm-project/pull/137102 ? (need to work on tests but wanted you to be able to test quickly - I'm currently waiting on a fresh build alas so the PR is currently done blind) https://github.com/l

[clang] [clang][p2719] Module deserialization does not restore allocator flags (PR #137102)

2025-04-23 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/137102 When serializing and deserializing a FunctionDecl we don't recover whether or not the decl was a type aware allocator or destroying delete, because in the final PR that information was placed in a side table in

[clang] [clang] Ensure correct copying of records with authenticated fields (PR #136783)

2025-04-23 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > Do we need to do anything special for constant expression handling? I do not believe so as pointer auth does not occur during consteval, but I'll see if we have any additional existing tests that I haven't included here. If not I'll add some new ones: - [ ] Type checking (e.g.

[clang] [clang] Ensure correct copying of records with authenticated fields (PR #136783)

2025-04-23 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt edited https://github.com/llvm/llvm-project/pull/136783 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Ensure correct copying of records with authenticated fields (PR #136783)

2025-04-23 Thread Oliver Hunt via cfe-commits
@@ -2801,6 +2801,10 @@ static bool isTriviallyCopyableTypeImpl(const QualType &type, if (type.hasNonTrivialObjCLifetime()) return false; + QualType::PrimitiveCopyKind PCK = type.isNonTrivialToPrimitiveCopy(); + if (PCK != QualType::PCK_Trivial && PCK != QualType::PCK_

[clang] [clang] Add builtin_get_vtable_pointer and virtual_member_address (PR #135469)

2025-04-15 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > Oof. On the one hand, we don't want to break your existing users. On the > other hand, we don't want to force the much broader audience of users into a > worse interface. Are those uses in your downstream able to use things like > fix-its to switch from the reference-based inte

<    1   2   3   4   >