[clang] 9d3a3fa - [clang][AST] Print OnePastTheEnd bit in `APValue::dump()` (#214450)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 7 00:47:41 PDT 2026
Author: Timm Baeder
Date: 2026-08-07T09:47:37+02:00
New Revision: 9d3a3fa57c47fd06efea20f100ec747f5e5fbfdd
URL: https://github.com/llvm/llvm-project/commit/9d3a3fa57c47fd06efea20f100ec747f5e5fbfdd
DIFF: https://github.com/llvm/llvm-project/commit/9d3a3fa57c47fd06efea20f100ec747f5e5fbfdd.diff
LOG: [clang][AST] Print OnePastTheEnd bit in `APValue::dump()` (#214450)
For lvalue APValues.
Added:
Modified:
clang/lib/AST/TextNodeDumper.cpp
clang/test/AST/ast-dump-APValue-lvalue.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp
index d987dd6cacd12..e9f0727becfe1 100644
--- a/clang/lib/AST/TextNodeDumper.cpp
+++ b/clang/lib/AST/TextNodeDumper.cpp
@@ -759,6 +759,7 @@ void TextNodeDumper::Visit(const APValue &Value, QualType Ty) {
}
OS << ", Null=" << Value.isNullPointer()
<< ", Offset=" << Value.getLValueOffset().getQuantity()
+ << ", OnePastTheEnd=" << Value.isLValueOnePastTheEnd()
<< ", HasPath=" << Value.hasLValuePath();
if (Value.hasLValuePath()) {
OS << ", PathLength=" << Value.getLValuePath().size();
diff --git a/clang/test/AST/ast-dump-APValue-lvalue.cpp b/clang/test/AST/ast-dump-APValue-lvalue.cpp
index f4cf2f5291760..92e881aca3d80 100644
--- a/clang/test/AST/ast-dump-APValue-lvalue.cpp
+++ b/clang/test/AST/ast-dump-APValue-lvalue.cpp
@@ -40,31 +40,35 @@ struct MP : P, Q {
void Test(int (&arr)[10]) {
constexpr int *pi = &i;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pi 'int *const' constexpr cinit
- // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=0, HasPath=1, PathLength=0, Path=()
+ // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=0, OnePastTheEnd=0, HasPath=1, PathLength=0, Path=()
+
+ constexpr int *pi2 = &i + 1;
+ // CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pi2 'int *const' constexpr cinit
+ // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=4, OnePastTheEnd=1, HasPath=1, PathLength=0, Path=()
constexpr int *psi = &s.i;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} psi 'int *const' constexpr cinit
- // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=0, HasPath=1, PathLength=1, Path=({{.*}})
+ // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=0, OnePastTheEnd=0, HasPath=1, PathLength=1, Path=({{.*}})
constexpr int *psii = &s.ii;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} psii 'int *const' constexpr cinit
- // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=4, HasPath=1, PathLength=1, Path=({{.*}})
+ // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=4, OnePastTheEnd=0, HasPath=1, PathLength=1, Path=({{.*}})
constexpr int *pf = &f.s.ii;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pf 'int *const' constexpr cinit
- // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=16, HasPath=1, PathLength=2, Path=({{.*}}, {{.*}})
+ // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=16, OnePastTheEnd=0, HasPath=1, PathLength=2, Path=({{.*}}, {{.*}})
constexpr char *pc = &f.padding[2];
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pc 'char *const' constexpr cinit
- // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=2, HasPath=1, PathLength=2, Path=({{.*}}, 2)
+ // CHECK-NEXT: | |-value: LValue Base=VarDecl {{.*}}, Null=0, Offset=2, OnePastTheEnd=0, HasPath=1, PathLength=2, Path=({{.*}}, 2)
constexpr const int *n = nullptr;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} n 'const int *const' constexpr cinit
- // CHECK-NEXT: | |-value: LValue Base=null, Null=1, Offset=0, HasPath=1, PathLength=0, Path=()
+ // CHECK-NEXT: | |-value: LValue Base=null, Null=1, Offset=0, OnePastTheEnd=0, HasPath=1, PathLength=0, Path=()
constexpr const std::type_info* pti = &typeid(int);
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pti 'const std::type_info *const' constexpr cinit
- // CHECK-NEXT: | |-value: LValue Base=TypeInfoLValue typeid(int), Null=0, Offset=0, HasPath=1, PathLength=0, Path=()
+ // CHECK-NEXT: | |-value: LValue Base=TypeInfoLValue typeid(int), Null=0, Offset=0, OnePastTheEnd=0, HasPath=1, PathLength=0, Path=()
constexpr int(MP::*pmi) = (int MP::*)&P::x;
// CHECK: | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} pmi 'int (MP::*const)' constexpr cinit
More information about the cfe-commits
mailing list