[clang] [clang][AST] Fix printing `TagDecl`s. (PR #69971)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 23 14:28:13 PDT 2023


zygoloid wrote:

I think this might be working around the issue rather than fixing it. It looks to me like the bug is in `Decl::printGroup`:

https://github.com/llvm/llvm-project/blob/f4023d4d5d6a6f35ef2315f1b1ce7dd35f24e901/clang/lib/AST/DeclPrinter.cpp#L223

We are printing the tag *definition* here if the tag *declaration* is part of the `DeclGroup`. I think that the `if(TD)` on the line above that one should instead be something like:
```c++
      if (TD && (TD->isThisDeclarationADefinition() || TD->isThisDeclarationADemotedDefinition()))
```

https://github.com/llvm/llvm-project/pull/69971


More information about the cfe-commits mailing list