aaron.ballman added inline comments.
================ Comment at: clang/lib/AST/ASTDumper.cpp:205 + if (const Decl *D = dyn_cast<Decl>(this)) + D->dump(); +} ---------------- erichkeane wrote: > aaron.ballman wrote: > > 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`. > I've DEFINITELY run into it in the debugger before, but I have no idea WHAT > case that is. It is sometimes just "DeclContext is an invalid pointer" kinda > thing, so it might be worth-while to have SOME output besides "print > nothing", particularly when debugging. IIRC, the case this comes up in is when the object is only partially constructed, and so I agree that having an `else` clause here would be useful -- because this interface is predominately used from a debugger, it has to deal with special "impossible" situations a bit more carefully. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133499/new/ https://reviews.llvm.org/D133499 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits