[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 11:14:21 PDT 2022


zixuw created this revision.
Herald added a subscriber: ributzka.
Herald added a reviewer: dang.
Herald added a reviewer: ributzka.
Herald added a project: All.
zixuw requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

ExtractAPI doesn't care about locations of anonymous TagDecls. Set the
printing policy to exclude that from anonymous decl names.


Repository:
  rG LLVM Github Monorepo

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,9 @@
   CI.getPreprocessor().addPPCallbacks(std::make_unique<MacroCallback>(
       CI.getSourceManager(), *LCF, *API, CI.getPreprocessor()));
 
+  // Do not include location in anonymous decls.
+  CI.getASTContext().getPrintingPolicy().AnonymousTagLocations = false;
+
   return std::make_unique<ExtractAPIConsumer>(CI.getASTContext(),
                                               std::move(LCF), *API);
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135295.465476.patch
Type: text/x-patch
Size: 640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221005/7964fade/attachment.bin>


More information about the cfe-commits mailing list