[llvm-branch-commits] [clang] [Clang] Add pointer field protection feature. (PR #172119)

Peter Collingbourne via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 16 09:54:44 PST 2026


https://github.com/pcc updated https://github.com/llvm/llvm-project/pull/172119

>From 98b458c43bd3b89075d5f5594c2b970ddb95da17 Mon Sep 17 00:00:00 2001
From: Peter Collingbourne <pcc at google.com>
Date: Fri, 12 Dec 2025 17:49:29 -0800
Subject: [PATCH 1/2] Format

Created using spr 1.3.6-beta.1
---
 clang/lib/Sema/SemaDeclAttr.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index f3737080503f2..c252a8c162a25 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -8032,7 +8032,8 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL,
 
   case ParsedAttr::AT_PointerFieldProtection:
     if (!S.getLangOpts().PointerFieldProtectionAttr)
-      S.Diag(AL.getLoc(), diag::err_attribute_pointer_field_protection_experimental)
+      S.Diag(AL.getLoc(),
+             diag::err_attribute_pointer_field_protection_experimental)
           << AL << AL.isRegularKeywordAttribute() << D->getLocation();
     handleSimpleAttribute<PointerFieldProtectionAttr>(S, D, AL);
     break;

>From ebe07b45cf34d5b125ae2554c5225054fbcb1ac6 Mon Sep 17 00:00:00 2001
From: Peter Collingbourne <pcc at google.com>
Date: Fri, 16 Jan 2026 09:54:28 -0800
Subject: [PATCH 2/2] Fix test on non-aarch64

Created using spr 1.3.6-beta.1
---
 clang/test/CodeGenCXX/pfp-attribute-disable.cpp | 2 +-
 clang/test/CodeGenCXX/pfp-load-store.cpp        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/test/CodeGenCXX/pfp-attribute-disable.cpp b/clang/test/CodeGenCXX/pfp-attribute-disable.cpp
index 1f09f72af66f5..4a7ec7974636b 100644
--- a/clang/test/CodeGenCXX/pfp-attribute-disable.cpp
+++ b/clang/test/CodeGenCXX/pfp-attribute-disable.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1  -fexperimental-pointer-field-protection-abi -fexperimental-pointer-field-protection-tagged -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple aarch64-linux -fexperimental-pointer-field-protection-abi -fexperimental-pointer-field-protection-tagged -emit-llvm -o - %s | FileCheck %s
 
 
 struct S {
diff --git a/clang/test/CodeGenCXX/pfp-load-store.cpp b/clang/test/CodeGenCXX/pfp-load-store.cpp
index 118dda7789bba..bc947cdd0cf67 100644
--- a/clang/test/CodeGenCXX/pfp-load-store.cpp
+++ b/clang/test/CodeGenCXX/pfp-load-store.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1  -fexperimental-pointer-field-protection-abi -fexperimental-pointer-field-protection-tagged -emit-llvm -O1 -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple aarch64-linux -fexperimental-pointer-field-protection-abi -fexperimental-pointer-field-protection-tagged -emit-llvm -O1 -o - %s | FileCheck %s
 
 int val;
 



More information about the llvm-branch-commits mailing list