[clang] 6f7812f - [clang][Interp][NFC] Improve Pointer::print()

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 17 00:22:08 PDT 2023


Author: Timm Bäder
Date: 2023-08-17T09:21:51+02:00
New Revision: 6f7812fdabd9df282d1a9b4e42c17aa3aa77d431

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

LOG: [clang][Interp][NFC] Improve Pointer::print()

Print the symbolic values of Base and Offset if appropriate.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Pointer.h b/clang/lib/AST/Interp/Pointer.h
index a5e7ad8af81898..f8e3802d4a2299 100644
--- a/clang/lib/AST/Interp/Pointer.h
+++ b/clang/lib/AST/Interp/Pointer.h
@@ -350,7 +350,17 @@ class Pointer {
 
   /// Prints the pointer.
   void print(llvm::raw_ostream &OS) const {
-    OS << Pointee << " {" << Base << ", " << Offset << ", ";
+    OS << Pointee << " {";
+    if (Base == RootPtrMark)
+      OS << "rootptr, ";
+    else
+      OS << Base << ", ";
+
+    if (Offset == PastEndMark)
+      OS << "pastend, ";
+    else
+      OS << Offset << ", ";
+
     if (Pointee)
       OS << Pointee->getSize();
     else


        


More information about the cfe-commits mailing list