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

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 22 07:27:16 PDT 2026


Author: Timm Baeder
Date: 2026-04-22T16:27:12+02:00
New Revision: b77a894afa2ef0682139d65446484aa2e7e9678e

URL: https://github.com/llvm/llvm-project/commit/b77a894afa2ef0682139d65446484aa2e7e9678e
DIFF: https://github.com/llvm/llvm-project/commit/b77a894afa2ef0682139d65446484aa2e7e9678e.diff

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

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

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/Pointer.h

Removed: 
    


################################################################################
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