[NFC] Add ClangNode::dump()

This commit is contained in:
Brent Royal-Gordon
2020-08-19 20:50:28 -07:00
parent 443e091d8c
commit 6c18a03883
2 changed files with 14 additions and 0 deletions

View File

@@ -116,6 +116,17 @@ const clang::Module *ClangNode::getClangModule() const {
return nullptr;
}
void ClangNode::dump() const {
if (auto D = getAsDecl())
D->dump();
else if (auto M = getAsMacro())
M->dump();
else if (auto M = getAsModule())
M->dump();
else
llvm::errs() << "ClangNode contains nullptr\n";
}
// Only allow allocation of Decls using the allocator in ASTContext.
void *Decl::operator new(size_t Bytes, const ASTContext &C,
unsigned Alignment) {