[clang] [clang][bytecode] Fix newly added pfp test (PR #184137)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 2 06:47:16 PST 2026
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/184137
Do the same thing 370d7ce58011eccfab8105eddbc028cc09c4c5e5 did in ExprConstant.cpp
>From fc68117d4f4f65c73c92f8b3dd047c76601743d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Mon, 2 Mar 2026 15:45:05 +0100
Subject: [PATCH] [clang][bytecode] Fix newly added pfp test
Do the same thing 370d7ce58011eccfab8105eddbc028cc09c4c5e5 did in
ExprConstant.cpp
---
clang/lib/AST/ByteCode/InterpBuiltin.cpp | 1 +
clang/test/CodeGenCXX/pfp-member-pointer-offsetof.cpp | 1 +
2 files changed, 2 insertions(+)
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 62cb37f720af2..c7d3c2e500592 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -5971,6 +5971,7 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
bool InterpretOffsetOf(InterpState &S, CodePtr OpPC, const OffsetOfExpr *E,
ArrayRef<int64_t> ArrayIndices, int64_t &IntResult) {
+ S.getASTContext().recordOffsetOfEvaluation(E);
CharUnits Result;
unsigned N = E->getNumComponents();
assert(N > 0);
diff --git a/clang/test/CodeGenCXX/pfp-member-pointer-offsetof.cpp b/clang/test/CodeGenCXX/pfp-member-pointer-offsetof.cpp
index 842bdd7e9f83d..d4abf27c01dc4 100644
--- a/clang/test/CodeGenCXX/pfp-member-pointer-offsetof.cpp
+++ b/clang/test/CodeGenCXX/pfp-member-pointer-offsetof.cpp
@@ -1,3 +1,4 @@
+// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm -fexperimental-allow-pointer-field-protection-attr -fexperimental-pointer-field-protection-abi -o - %s -fexperimental-new-constant-interpreter | FileCheck %s
// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm -fexperimental-allow-pointer-field-protection-attr -fexperimental-pointer-field-protection-abi -o - %s | FileCheck %s
// CHECK: @__pfp_ds__ZTS1S.ptr1 = hidden alias i8, inttoptr (i64 3573751839 to ptr)
More information about the cfe-commits
mailing list