ExtractAPI doesn't care about locations of anonymous TagDecls. Set the
printing policy to exclude that from anonymous decl names.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LG from my side assuming you're happy with the strings changing.
This doesn't affect tests because anonymous decls currently print as the empty string, but will soon print as (unnamed struct at /path/foo.cpp:4:1) without this patch, or (unnamed struct) with this patch.
clang/lib/ExtractAPI/ExtractAPIConsumer.cpp | ||
---|---|---|
854 | nit: this isn't *just* clearing AnonymousTagLocations, but also resetting any other PP flags to defaults based on LangOpts. You could getPrintingPolicy() instead if you didn't intend to do this. |
clang/lib/ExtractAPI/ExtractAPIConsumer.cpp | ||
---|---|---|
854 | Makes sense. Probably doesn't matter because I'm pretty sure PrintingPolicy for ExtractAPI is just the default now. Still, good to use getPrintingPolicy to be sure |
Update on top of the existing PrintingPolicy in the ASTContext instead of creating a new default one.
Doesn't affect any test for this patch as expected. Still need to see how does it interacts with https://reviews.llvm.org/D134813.
nit: this isn't *just* clearing AnonymousTagLocations, but also resetting any other PP flags to defaults based on LangOpts. You could getPrintingPolicy() instead if you didn't intend to do this.