Skip to content

Commit 485d556

Browse files
committed
[clang][Interp][NFC] Add Block::dump()
1 parent f4f772c commit 485d556

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

clang/lib/AST/Interp/Disasm.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,19 @@ LLVM_DUMP_METHOD void Record::dump(llvm::raw_ostream &OS, unsigned Indentation,
264264
++I;
265265
}
266266
}
267+
268+
LLVM_DUMP_METHOD void Block::dump(llvm::raw_ostream &OS) const {
269+
{
270+
ColorScope SC(OS, true, {llvm::raw_ostream::BRIGHT_BLUE, true});
271+
OS << "Block " << (void *)this << "\n";
272+
}
273+
unsigned NPointers = 0;
274+
for (const Pointer *P = Pointers; P; P = P->Next) {
275+
++NPointers;
276+
}
277+
OS << " Pointers: " << NPointers << "\n";
278+
OS << " Dead: " << IsDead << "\n";
279+
OS << " Static: " << IsStatic << "\n";
280+
OS << " Extern: " << IsExtern << "\n";
281+
OS << " Initialized: " << IsInitialized << "\n";
282+
}

clang/lib/AST/Interp/InterpBlock.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ class Block final {
118118
IsInitialized = false;
119119
}
120120

121+
void dump() const { dump(llvm::errs()); }
122+
void dump(llvm::raw_ostream &OS) const;
123+
121124
protected:
122125
friend class Pointer;
123126
friend class DeadBlock;

0 commit comments

Comments
 (0)