[clang] [clang][bytecode] print array root state in Pointer::print() (PR #193494)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 22 06:16:33 PDT 2026


https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/193494

And check isZero() so later output checks don't run into null pointers as much.

>From 291ff19a9dc125e9eb34b472abb65fa4d2ce97f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Wed, 22 Apr 2026 15:14:12 +0200
Subject: [PATCH] [clang][bytecode] print array root state in Pointer::print()

And check isZero() so later output checks don't run into null pointers
as much.
---
 clang/lib/AST/ByteCode/Pointer.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/clang/lib/AST/ByteCode/Pointer.h b/clang/lib/AST/ByteCode/Pointer.h
index 1c2b2f7699d17..9cc7af4c78241 100644
--- a/clang/lib/AST/ByteCode/Pointer.h
+++ b/clang/lib/AST/ByteCode/Pointer.h
@@ -888,6 +888,9 @@ class Pointer {
 inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Pointer &P) {
   P.print(OS);
   OS << ' ';
+  if (P.isZero())
+    return OS;
+
   if (const Descriptor *D = P.getFieldDesc())
     D->dump(OS);
   if (P.isArrayElement()) {
@@ -895,7 +898,9 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Pointer &P) {
       OS << " one-past-the-end";
     else
       OS << " index " << P.getIndex();
-  }
+  } else if (P.isArrayRoot())
+    OS << " arrayroot";
+
   if (P.isBlockPointer() && P.block() && P.block()->isDummy())
     OS << " dummy";
   if (!P.isLive())



More information about the cfe-commits mailing list