[clang] 1116d03 - [clang][bytecode] Fix debug-printing one-past-the-end pointers (#181149)

via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 12 07:14:32 PST 2026


Author: Timm Baeder
Date: 2026-02-12T16:14:27+01:00
New Revision: 1116d0388cc02d8444521155e02ccdae3a52f8c0

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

LOG: [clang][bytecode] Fix debug-printing one-past-the-end pointers (#181149)

Can't call `getIndex()` on those.

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 2515b2fe56ab9..5c3f98ad01eb4 100644
--- a/clang/lib/AST/ByteCode/Pointer.h
+++ b/clang/lib/AST/ByteCode/Pointer.h
@@ -869,8 +869,12 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Pointer &P) {
   OS << ' ';
   if (const Descriptor *D = P.getFieldDesc())
     D->dump(OS);
-  if (P.isArrayElement())
-    OS << " index " << P.getIndex();
+  if (P.isArrayElement()) {
+    if (P.isOnePastEnd())
+      OS << " one-past-the-end";
+    else
+      OS << " index " << P.getIndex();
+  }
   return OS;
 }
 


        


More information about the cfe-commits mailing list