[PATCH] D135295: [clang][ExtractAPI] Don't print locations for anonymous tags
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 5 11:55:06 PDT 2022
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.
LG from my side assuming you're happy with the strings changing.
In D135295#3837734 <https://reviews.llvm.org/D135295#3837734>, @ributzka wrote:
> This doesn't affect any tests?
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.
================
Comment at: clang/lib/ExtractAPI/ExtractAPIConsumer.cpp:854
+ // Do not include location in anonymous decls.
+ PrintingPolicy Policy(CI.getASTContext().getLangOpts());
+ Policy.AnonymousTagLocations = false;
----------------
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.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135295/new/
https://reviews.llvm.org/D135295
More information about the cfe-commits
mailing list