[clang] [Clang] Fix createConstexprUnknownAPValues to use zero offset when ceating APValue (PR #124478)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 26 11:56:12 PST 2025


https://github.com/shafik created https://github.com/llvm/llvm-project/pull/124478

When implmenting P2280R4 here: https://github.com/llvm/llvm-project/pull/95474

When creating the APValue to store and constexprUnknown value I used an offset of CharUnits::One() but it should have been CharUnits::Zero().

This change just adjusts that value.

>From 06a51097d568799d1e5a2941da9f1b050b4440cd Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour <shafik.yaghmour at intel.com>
Date: Sun, 26 Jan 2025 11:50:55 -0800
Subject: [PATCH] [Clang] Fix createConstexprUnknownAPValues to use zero offset
 when creating APValue

When implmenting P2280R4 here: https://github.com/llvm/llvm-project/pull/95474

When creating the APValue to store and constexprUnknown value I used an offset
of CharUnits::One() but it should have been CharUnits::Zero().

This change just adjusts that value.
---
 clang/lib/AST/ExprConstant.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 3b5ab839c6cf79..be8f1fe02e7212 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -1961,7 +1961,7 @@ APValue &
 CallStackFrame::createConstexprUnknownAPValues(const VarDecl *Key,
                                                APValue::LValueBase Base) {
   APValue &Result = ConstexprUnknownAPValues[MapKeyTy(Key, Base.getVersion())];
-  Result = APValue(Base, CharUnits::One(), APValue::ConstexprUnknown{});
+  Result = APValue(Base, CharUnits::Zero(), APValue::ConstexprUnknown{});
 
   return Result;
 }



More information about the cfe-commits mailing list