[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

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

2025-04-15 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt converted_to_draft https://github.com/llvm/llvm-project/pull/135469 ___ 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-15 Thread Oliver Hunt via cfe-commits
ojhunt wrote: pending the above changes I'll remove the review flag so people aren't confused https://github.com/llvm/llvm-project/pull/135469 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-c

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

2025-04-15 Thread Oliver Hunt via cfe-commits
@@ -5349,6 +5350,40 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, return RValue::get(Result); } + case Builtin::BI__builtin_virtual_member_address: { +Address This = EmitLValue(E->getArg(0)).getAddress(); +APValue ConstMemF

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

2025-04-15 Thread Oliver Hunt via cfe-commits
@@ -5349,6 +5350,40 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, return RValue::get(Result); } + case Builtin::BI__builtin_virtual_member_address: { +Address This = EmitLValue(E->getArg(0)).getAddress(); +APValue ConstMemF

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

2025-04-15 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-15 Thread Oliver Hunt via cfe-commits
@@ -1782,6 +1782,92 @@ static ExprResult PointerAuthStringDiscriminator(Sema &S, CallExpr *Call) { return Call; } +static ExprResult VirtualMemberAddress(Sema &S, CallExpr *Call) { + if (S.checkArgCount(Call, 2)) +return ExprError(); + + for (int i = 0; i < 2; ++i) {

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

2025-04-15 Thread Oliver Hunt via cfe-commits
@@ -1782,6 +1782,92 @@ static ExprResult PointerAuthStringDiscriminator(Sema &S, CallExpr *Call) { return Call; } +static ExprResult VirtualMemberAddress(Sema &S, CallExpr *Call) { + if (S.checkArgCount(Call, 2)) +return ExprError(); + + for (int i = 0; i < 2; ++i) {

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

2025-04-15 Thread Oliver Hunt via cfe-commits
ojhunt wrote: It's even more dumb, but I have this fixed and am writing tests 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] [RFC] Initial implementation of P2719 (PR #113510)

2025-04-10 Thread Oliver Hunt via 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

[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 created https://github.com/llvm/llvm-project/pull/135686 The P2719 implementation refactored diagnostics for cleanup delete, and as part of that I attempted to fix handling of inaccessible cleanup operator delete. Alas the new branch was incorrect as it was performing

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

2025-04-12 Thread Oliver Hunt via cfe-commits
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/7] [Clang] Consider preferred_type in bitfield warnings (#116760)

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

2025-04-12 Thread Oliver Hunt via cfe-commits
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/8] [Clang] Consider preferred_type in bitfield warnings (#116760)

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

2025-04-12 Thread Oliver Hunt via cfe-commits
@@ -0,0 +1,414 @@ +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fsyntax-only -verify -std=c++23 -Wno-unused-value -Wno-unused-but-set-variable +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fsyntax-only -verify=expected,bitfieldwarnings -std=c++23 -Wno-unused-valu

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

2025-04-12 Thread Oliver Hunt via cfe-commits
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/9] [Clang] Consider preferred_type in bitfield warnings (#116760)

[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 3c20ae33d51c4e8e7a80e7f1477de02c02dec513 Mon Sep 17 00:00:00 2001 From: Ahmed Bougacha Date: Mon, 27 Sep 2021 08:00:00 -0700 Subject: [PATCH] [clang] Add builtin_get_vtable_pointer and virtual_member_addre

[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 e03f70335defeba6b5e173618b01ed8e3876034a 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] [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 edited https://github.com/llvm/llvm-project/pull/135469 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-04-27 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/137580 __ptrauth_restricted_intptr provides a mechanism to apply pointer authentication to pointer sized integer types. >From 7af378bbec4c7cf3896f6f7bc95d816e398930f2 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: S

[clang] Silence spurious -Wnontrivial-memcall warnings in C mode (PR #137429)

2025-04-25 Thread Oliver Hunt via cfe-commits
@@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -fptrauth-calls -fptrauth-intrinsics -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fptrauth-calls -fptrauth-intrinsics -fsyntax-only -verify %s + ojhunt wrote: Given there ar

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

2025-04-28 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Ah, slot FLT_EVAL_METHOD is used in source as well, in that case I think the fix is to make signed options an option (pun intended) https://github.com/llvm/llvm-project/pull/137661 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2025-04-28 Thread Oliver Hunt via cfe-commits
ojhunt wrote: although, what happens currently? Per the warning we should be producing the wrong value if there's a direct enum value to code visible value mapping https://github.com/llvm/llvm-project/pull/137661 ___ cfe-commits mailing list cfe-commi

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

2025-04-28 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Warning fix is tracked by https://github.com/llvm/llvm-project/pull/137661 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-commit

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

2025-04-28 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > Perhaps silly initial question: why do we need a whole different qualifier > for this? Why can you not write `__ptrauth uintptr_t foo`? Not a silly question, back when first implemented we spent time thinking about this. The concern was basically `T* __ptrauth(...)` can repres

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

2025-04-29 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 > > > > > > > > > > > > I think I would prefer this solution

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

2025-05-01 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > > I think this is a reasonable way forward for right now; we can bring back > > the enumerator once we're actually using it. WDYT @zahiraam ? > > I tend to think so too. But I am waiting for a response from the math library > people internally to make sure that we don't loose c

[clang] [clang][ptrauth] reject incorrectly placed ptrauth qualifier (PR #138376)

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

[clang] [clang] rename FPOptions.def's macro to FP_OPTION (PR #138374)

2025-05-02 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > LGTM, but I have only done a very isolated change on this code before. Righto, I'll wait for @zahiraam and/or @AaronBallman as well https://github.com/llvm/llvm-project/pull/138374 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

[clang] [clang] make it possible to disable c++26 type aware allocators (PR #138372)

2025-05-02 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/138372 Per the feedback from the Clang Area Team, this PR makes P2719 only on by default when targeting C++26, and adds a flag to explicitly enable or disable support. >From ce3630845859d8771ec112c1c091134953bac7c5 Mo

[clang] [clang] make it possible to disable c++26 type aware allocators (PR #138372)

2025-05-02 Thread Oliver Hunt via cfe-commits
ojhunt wrote: Adding @AaronBallman and @cor3ntin as reviewers as you were the primary reviewers for the main PR, and I can't recall which of you requested I remove the flag and c++26 gating :D https://github.com/llvm/llvm-project/pull/138372 ___ cfe-

[clang] [clang] make it possible to disable c++26 type aware allocators (PR #138372)

2025-05-02 Thread Oliver Hunt via cfe-commits
ojhunt wrote: (I'm still waiting for the full test suite to finish running, boy howdy does it take a long time :D) https://github.com/llvm/llvm-project/pull/138372 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [clang] rename FPOptions.def's macro to FP_OPTION (PR #138374)

2025-05-02 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/138374 While investigating the recent warnings around FEM_Indeterminate I noticed that the macro name for FPOptions.def was given the very generic name `OPTION`. This PR renames it to FP_OPTION instead. >From f3351a66

[clang] [clang] rename FPOptions.def's macro to FP_OPTION (PR #138374)

2025-05-02 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/138374 >From 60eeaf0edd0a58bcdac4afad44ed097efdcd83f3 Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Fri, 2 May 2025 19:20:27 -0700 Subject: [PATCH] [clang] rename FPOptions.def's macro to FP_OPTION While investigati

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

2025-05-01 Thread Oliver Hunt via cfe-commits
ojhunt wrote: > I realize you've got downstream users making use of this additional > qualifier. Can you mention how prevalent the use is? it's used a bunch in libcxx, libcxxabi, libunwind, compiler-rt and a few other places. We can obviously use a macro to wrap this, but we need to have a wa

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

2025-05-03 Thread Oliver Hunt via cfe-commits
ojhunt wrote: @AaronBallman have you made a decision? (if the keyword has to go away I need to replace all the tests and work out how to integrate with other libraries downstream in a way that works in both modes) https://github.com/llvm/llvm-project/pull/137580 ___

[clang] [clang] Constant-evaluate format strings as last resort (PR #135864)

2025-05-03 Thread Oliver Hunt via cfe-commits
=?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier Message-ID: In-Reply-To: ojhunt wrote: The pointer auth options PR would also benefit from this - it currently has an ad hoc and restricted version of this as it needed to support

[clang] [clang][ptrauth] reject incorrectly placed ptrauth qualifier (PR #138376)

2025-05-02 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/138376 When parsing a function pointer typed field we use Parser::ParseTypeQualifierListOpt, but then drops subsequent type attributes and qualifiers unless explicitly handled. There is an existing solution for the _A

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

2025-05-02 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/136828 >From d51ed1b628eac11e3ff1a2bb5fffd87e7ca127ea 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] [lldb] [clang] Add `__ptrauth_restricted_intptr` qualifier (PR #137580)

2025-05-02 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/137580 >From 9c29520abea852086f8f4c555e2ad1ea7c711800 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] [lldb] [clang] Add support for `__ptrauth` being applied to integer types (PR #137580)

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

[clang] [Clang][diagnostics] Fix structured binding shadows template param loc (PR #129116)

2025-02-27 Thread Oliver Hunt via cfe-commits
@@ -162,3 +162,8 @@ struct A { }; A<0>::B a; } + +template void shadow9() { // expected-note{{template parameter is declared here}} + using arr = int[1]; // expected-warning@+1 {{decomposition declarations are a C++17 extension}} + auto [T] = arr{}; // expected-error {{de

<    1   2   3   4   5   >