[PATCH] D135295: [clang][ExtractAPI] Don't print locations for anonymous tags
Zixu Wang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 5 12:28:50 PDT 2022
zixuw updated this revision to Diff 465505.
zixuw added a comment.
Update on top of the existing PrintingPolicy in the ASTContext instead of creating a new default one.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135295/new/
https://reviews.llvm.org/D135295
Files:
clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
Index: clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
===================================================================
--- clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
+++ clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
@@ -850,6 +850,11 @@
CI.getPreprocessor().addPPCallbacks(std::make_unique<MacroCallback>(
CI.getSourceManager(), *LCF, *API, CI.getPreprocessor()));
+ // Do not include location in anonymous decls.
+ PrintingPolicy Policy = CI.getASTContext().getPrintingPolicy();
+ Policy.AnonymousTagLocations = false;
+ CI.getASTContext().setPrintingPolicy(Policy);
+
return std::make_unique<ExtractAPIConsumer>(CI.getASTContext(),
std::move(LCF), *API);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135295.465505.patch
Type: text/x-patch
Size: 725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221005/8ba2a91a/attachment.bin>
More information about the cfe-commits
mailing list