[PATCH] D133499: [clang]: Add DeclContext::dumpDecl() in order to conveniently dump an AST from a DeclContext.
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 8 10:46:19 PDT 2022
aaron.ballman added inline comments.
================
Comment at: clang/lib/AST/ASTDumper.cpp:204
+LLVM_DUMP_METHOD void DeclContext::dumpDecl() const {
+ if (const Decl *D = dyn_cast<Decl>(this))
+ D->dump();
----------------
================
Comment at: clang/lib/AST/ASTDumper.cpp:205
+ if (const Decl *D = dyn_cast<Decl>(this))
+ D->dump();
+}
----------------
erichkeane wrote:
> One thing to note is that the 'else' case here is a little uninformative. See https://clang.llvm.org/doxygen/DeclBase_8cpp_source.html#l00915 for some similar logic here (though not sure we should be emulating that).
>
> More, I wonder if there is SOME message here that should be dumped for 'else'.
Looking at what inherits from `DeclContext`, is there use of it which is *not* a `Decl`? I couldn't find a use where it's not also a `Decl`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133499/new/
https://reviews.llvm.org/D133499
More information about the cfe-commits
mailing list