[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:37:36 PDT 2022


zixuw updated this revision to Diff 465486.
zixuw added a comment.

Set PrintingPolicy properly


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().getLangOpts());
+  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.465486.patch
Type: text/x-patch
Size: 718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221005/ebc52014/attachment-0001.bin>


More information about the cfe-commits mailing list