[clang] [clang] improve print / dump of anonymous declarations (PR #124605)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 28 08:28:32 PST 2025


erichkeane wrote:

> f == b::c;
> }
> $ clang  "-cc1" "-triple" "x86_64-grtev4-linux-gnu" "-std=gnu++20"  "-x" "c++" -analyze  -analyzer-checker=debug.DumpCFG parser_test-42bc8e.cpp
> parser_test-42bc8e.cpp:10:5: warning: equality comparison result unused [-Wunused-comparison]
>    10 |   f == b::c;

Hmm... This only repro's in the CFG printer (that is, AST-Print and AST-Dump have no problem with this).

This happens when doing a `printPretty` call to the `StmtPrinter` with expression: `DeclRefExpr 0x159c2030 'b':'class b' lvalue ParmVar 0x159a0308 depth 0 index 0 'b':'class b'`

So it is failing on the new 1289 in StmtPrinter.cpp, since it is trying to refer to an unnamed `ParmVar`.  IMO, we should probably make sure that `TextNodeDumper` there is handling all of the decls we do elsewhere.

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


More information about the cfe-commits mailing list