diff options
author | Timm Bäder <tbaeder@redhat.com> | 2024-04-13 06:10:38 +0200 |
---|---|---|
committer | Timm Bäder <tbaeder@redhat.com> | 2024-04-16 11:15:11 +0200 |
commit | 485d556d8c23b54da952e75c3cadc9db3050fd9e (patch) | |
tree | aa881aabdbbb676e13f548001ed529e759c6be37 | |
parent | f4f772ceef379bd434d266b6e0d2bbdf796f81cb (diff) |
[clang][Interp][NFC] Add Block::dump()
-rw-r--r-- | clang/lib/AST/Interp/Disasm.cpp | 16 | ||||
-rw-r--r-- | clang/lib/AST/Interp/InterpBlock.h | 3 |
2 files changed, 19 insertions, 0 deletions
diff --git a/clang/lib/AST/Interp/Disasm.cpp b/clang/lib/AST/Interp/Disasm.cpp index 022b394e58e6..ebc4e4f195ba 100644 --- a/clang/lib/AST/Interp/Disasm.cpp +++ b/clang/lib/AST/Interp/Disasm.cpp @@ -264,3 +264,19 @@ LLVM_DUMP_METHOD void Record::dump(llvm::raw_ostream &OS, unsigned Indentation, ++I; } } + +LLVM_DUMP_METHOD void Block::dump(llvm::raw_ostream &OS) const { + { + ColorScope SC(OS, true, {llvm::raw_ostream::BRIGHT_BLUE, true}); + OS << "Block " << (void *)this << "\n"; + } + unsigned NPointers = 0; + for (const Pointer *P = Pointers; P; P = P->Next) { + ++NPointers; + } + OS << " Pointers: " << NPointers << "\n"; + OS << " Dead: " << IsDead << "\n"; + OS << " Static: " << IsStatic << "\n"; + OS << " Extern: " << IsExtern << "\n"; + OS << " Initialized: " << IsInitialized << "\n"; +} diff --git a/clang/lib/AST/Interp/InterpBlock.h b/clang/lib/AST/Interp/InterpBlock.h index 9db82567d2d5..6d5856fbd4ea 100644 --- a/clang/lib/AST/Interp/InterpBlock.h +++ b/clang/lib/AST/Interp/InterpBlock.h @@ -118,6 +118,9 @@ public: IsInitialized = false; } + void dump() const { dump(llvm::errs()); } + void dump(llvm::raw_ostream &OS) const; + protected: friend class Pointer; friend class DeadBlock; |