Author: Timm Bäder
Date: 2024-04-09T07:55:36+02:00
New Revision: 5d1f779540517f47abb4927f4ded51cac94fd366

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

LOG: [clang][Interp][NFC] Add Dump debug op

This is often useful for debugging and dumps the current stack
contents.

Added: 
    

Modified: 
    clang/lib/AST/Interp/Interp.h
    clang/lib/AST/Interp/Opcodes.td

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h
index 405993eb827036..fe5da47d9027c8 100644
--- a/clang/lib/AST/Interp/Interp.h
+++ b/clang/lib/AST/Interp/Interp.h
@@ -1333,6 +1333,11 @@ inline bool FinishInit(InterpState &S, CodePtr OpPC) {
   return true;
 }
 
+inline bool Dump(InterpState &S, CodePtr OpPC) {
+  S.Stk.dump();
+  return true;
+}
+
 inline bool VirtBaseHelper(InterpState &S, CodePtr OpPC, const RecordDecl 
*Decl,
                            const Pointer &Ptr) {
   Pointer Base = Ptr;

diff  --git a/clang/lib/AST/Interp/Opcodes.td b/clang/lib/AST/Interp/Opcodes.td
index cc1310f4c0d52a..6e79a03203d276 100644
--- a/clang/lib/AST/Interp/Opcodes.td
+++ b/clang/lib/AST/Interp/Opcodes.td
@@ -723,3 +723,8 @@ def CheckNonNullArg : Opcode {
 }
 
 def Memcpy : Opcode;
+
+//===----------------------------------------------------------------------===//
+// Debugging.
+//===----------------------------------------------------------------------===//
+def Dump : Opcode;


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to