diff options
author | Zixu Wang <zixu_wang@apple.com> | 2022-10-05 20:59:58 +0300 |
---|---|---|
committer | Zixu Wang <zixu_wang@apple.com> | 2022-10-05 23:11:21 +0300 |
commit | 5301826fa86aa520b65c86abbe3b3a7194849e27 (patch) | |
tree | c888ce32e2b4609214cae3c3eea9772960c29bbe /clang | |
parent | a93ec06ae6277480b3f3d7521f867a7099e68fc1 (diff) |
[clang][ExtractAPI] Don't print locations for anonymous tags
ExtractAPI doesn't care about locations of anonymous TagDecls. Set the
printing policy to exclude that from anonymous decl names.
Differential Revision: https://reviews.llvm.org/D135295
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/ExtractAPI/ExtractAPIConsumer.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp b/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp index 969ee772fa06..4a97ee9922dd 100644 --- a/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp +++ b/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp @@ -850,6 +850,11 @@ ExtractAPIAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) { 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); } |