[clang] [clang] improve print / dump of anonymous declarations (PR #124605)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 27 10:37:04 PST 2025
================
@@ -875,7 +875,41 @@ void TextNodeDumper::dumpBareDeclRef(const Decl *D) {
if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
ColorScope Color(OS, ShowColors, DeclNameColor);
- OS << " '" << ND->getDeclName() << '\'';
+ if (DeclarationName Name = ND->getDeclName())
+ OS << " '" << Name << '\'';
+ else
+ switch (ND->getKind()) {
+ case Decl::Decomposition: {
+ auto *DD = cast<DecompositionDecl>(ND);
+ OS << " first_binding '" << DD->bindings()[0]->getDeclName() << '\'';
+ break;
+ }
+ case Decl::Field: {
+ auto *FD = cast<FieldDecl>(ND);
+ OS << " index " << FD->getFieldIndex();
----------------
erichkeane wrote:
`index` here is actually kinda confusing compared with the template argument 'index', and I find myself wondering how valuable the index of the field in the decl is?
https://github.com/llvm/llvm-project/pull/124605
More information about the cfe-commits
mailing list