When the isCpp is enabled (true), the IsAnonymousRecordDecl() method correctly identifies anonymous structs. However, when isCpp is disabled (false), this method fails to recognize anonymous structs properly.
This inconsistency causes the subsequent logic to generate an AST node with an identifier "unname"(likely unintended), as the anonymous struct isn't handled at the expected stage.
The AST we expected, it works well when isCpp is true
{
"Doc": null,
"Loc": {
"File": "testdata/struct/temp.h",
"_Type": "Location"
},
"Name": null,
"Parent": null,
...
}
Unexpected, when isCpp is false
{
"Doc": null,
"Loc": {
"File": "testdata/struct/temp.h",
"_Type": "Location"
},
"Name": {
"Name": "struct (unnamed at testdata/struct/temp.h:1:1)",
"_Type": "Ident"
},
"Parent": null,
...
}
When the
isCppis enabled (true), theIsAnonymousRecordDecl()method correctly identifies anonymous structs. However, whenisCppis disabled (false), this method fails to recognize anonymous structs properly.This inconsistency causes the subsequent logic to generate an AST node with an identifier "unname"(likely unintended), as the anonymous struct isn't handled at the expected stage.
The AST we expected, it works well when
isCppistrue{ "Doc": null, "Loc": { "File": "testdata/struct/temp.h", "_Type": "Location" }, "Name": null, "Parent": null, ... }Unexpected, when
isCppisfalse{ "Doc": null, "Loc": { "File": "testdata/struct/temp.h", "_Type": "Location" }, "Name": { "Name": "struct (unnamed at testdata/struct/temp.h:1:1)", "_Type": "Ident" }, "Parent": null, ... }