[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

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

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-06-03 Thread Oliver Hunt via cfe-commits
@@ -3074,6 +3074,39 @@ following way: Query for this feature with ``__has_builtin(__builtin_offsetof)``. +``__builtin_get_vtable_pointer`` + + +``__builtin_get_vtable_pointer`` loads and authenticates the primary vtable +pointer from an instanc

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-06-03 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/139790 >From a933679801bde89b53584c4c65118658477db4da Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Tue, 13 May 2025 13:35:55 -0700 Subject: [PATCH 1/5] [clang][PAC] Add __builtin_get_vtable_pointer With pointer aut

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-06-03 Thread Oliver Hunt via cfe-commits
@@ -1825,6 +1825,37 @@ static ExprResult PointerAuthStringDiscriminator(Sema &S, CallExpr *Call) { return Call; } +static ExprResult GetVTablePointer(Sema &S, CallExpr *Call) { + if (S.checkArgCount(Call, 1)) +return ExprError(); + ExprResult ThisArg = S.DefaultFuncti

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-06-03 Thread Oliver Hunt via cfe-commits
@@ -3074,6 +3074,39 @@ following way: Query for this feature with ``__has_builtin(__builtin_offsetof)``. +``__builtin_get_vtable_pointer`` + + +``__builtin_get_vtable_pointer`` loads and authenticates the primary vtable +pointer from an instanc

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-06-03 Thread via cfe-commits
https://github.com/cor3ntin approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/139790 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-06-03 Thread via cfe-commits
https://github.com/cor3ntin edited https://github.com/llvm/llvm-project/pull/139790 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-06-03 Thread via cfe-commits
@@ -3074,6 +3074,39 @@ following way: Query for this feature with ``__has_builtin(__builtin_offsetof)``. +``__builtin_get_vtable_pointer`` + + +``__builtin_get_vtable_pointer`` loads and authenticates the primary vtable +pointer from an instanc

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-06-03 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/139790 >From a933679801bde89b53584c4c65118658477db4da Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Tue, 13 May 2025 13:35:55 -0700 Subject: [PATCH 1/2] [clang][PAC] Add __builtin_get_vtable_pointer With pointer aut

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-06-03 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/139790 >From a933679801bde89b53584c4c65118658477db4da Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Tue, 13 May 2025 13:35:55 -0700 Subject: [PATCH 1/3] [clang][PAC] Add __builtin_get_vtable_pointer With pointer aut

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-06-02 Thread Oliver Hunt via cfe-commits
@@ -1825,6 +1825,37 @@ static ExprResult PointerAuthStringDiscriminator(Sema &S, CallExpr *Call) { return Call; } +static ExprResult GetVTablePointer(Sema &S, CallExpr *Call) { + if (S.checkArgCount(Call, 1)) +return ExprError(); + ExprResult ThisArg = S.DefaultFuncti

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-06-02 Thread Anton Korobeynikov via cfe-commits
https://github.com/asl milestoned https://github.com/llvm/llvm-project/pull/139790 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-05-14 Thread via cfe-commits
@@ -1825,6 +1825,37 @@ static ExprResult PointerAuthStringDiscriminator(Sema &S, CallExpr *Call) { return Call; } +static ExprResult GetVTablePointer(Sema &S, CallExpr *Call) { + if (S.checkArgCount(Call, 1)) +return ExprError(); + ExprResult ThisArg = S.DefaultFuncti

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-05-13 Thread Oliver Hunt via cfe-commits
@@ -1825,6 +1825,37 @@ static ExprResult PointerAuthStringDiscriminator(Sema &S, CallExpr *Call) { return Call; } +static ExprResult GetVTablePointer(Sema &S, CallExpr *Call) { + if (S.checkArgCount(Call, 1)) +return ExprError(); + ExprResult ThisArg = S.DefaultFuncti

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-05-13 Thread via cfe-commits
@@ -1825,6 +1825,37 @@ static ExprResult PointerAuthStringDiscriminator(Sema &S, CallExpr *Call) { return Call; } +static ExprResult GetVTablePointer(Sema &S, CallExpr *Call) { + if (S.checkArgCount(Call, 1)) +return ExprError(); + ExprResult ThisArg = S.DefaultFuncti

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-05-13 Thread via cfe-commits
@@ -1825,6 +1825,37 @@ static ExprResult PointerAuthStringDiscriminator(Sema &S, CallExpr *Call) { return Call; } +static ExprResult GetVTablePointer(Sema &S, CallExpr *Call) { + if (S.checkArgCount(Call, 1)) +return ExprError(); + ExprResult ThisArg = S.DefaultFuncti

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-05-13 Thread via cfe-commits
https://github.com/cor3ntin edited https://github.com/llvm/llvm-project/pull/139790 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-05-13 Thread via cfe-commits
https://github.com/cor3ntin commented: Can you add tests for const types, and tests that check `__is_same_as(decltype(__builtin_get_vtable_pointer(foo)), const void*)` ? LGTM otherwise https://github.com/llvm/llvm-project/pull/139790 ___ cfe-commits m

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-05-13 Thread via cfe-commits
@@ -1825,6 +1825,37 @@ static ExprResult PointerAuthStringDiscriminator(Sema &S, CallExpr *Call) { return Call; } +static ExprResult GetVTablePointer(Sema &S, CallExpr *Call) { + if (S.checkArgCount(Call, 1)) +return ExprError(); + ExprResult ThisArg = S.DefaultFuncti

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-05-13 Thread via cfe-commits
@@ -1825,6 +1825,37 @@ static ExprResult PointerAuthStringDiscriminator(Sema &S, CallExpr *Call) { return Call; } +static ExprResult GetVTablePointer(Sema &S, CallExpr *Call) { + if (S.checkArgCount(Call, 1)) +return ExprError(); + ExprResult ThisArg = S.DefaultFuncti

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-05-13 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt updated https://github.com/llvm/llvm-project/pull/139790 >From a933679801bde89b53584c4c65118658477db4da Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Tue, 13 May 2025 13:35:55 -0700 Subject: [PATCH] [clang][PAC] Add __builtin_get_vtable_pointer With pointer authent

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-05-13 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff HEAD~1 HEAD --extensions cpp -- clang/test/CodeGenCXX/builtin-get-vtable-pointer.cpp

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-05-13 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-codegen Author: Oliver Hunt (ojhunt) Changes With pointer authentication it becomes non-trivial to correctly load the vtable pointer of a polymorphic object. __builtin_get_vtable_pointer is a function that performs the load and performs the appr

[clang] [clang][PAC] Add __builtin_get_vtable_pointer (PR #139790)

2025-05-13 Thread Oliver Hunt via cfe-commits
https://github.com/ojhunt created https://github.com/llvm/llvm-project/pull/139790 With pointer authentication it becomes non-trivial to correctly load the vtable pointer of a polymorphic object. __builtin_get_vtable_pointer is a function that performs the load and performs the appropriate au