diff options
author | Zixu Wang <zixu_wang@apple.com> | 2022-10-05 10:59:58 -0700 |
---|---|---|
committer | Zixu Wang <zixu_wang@apple.com> | 2022-10-05 13:11:21 -0700 |
commit | 5301826fa86aa520b65c86abbe3b3a7194849e27 (patch) | |
tree | c888ce32e2b4609214cae3c3eea9772960c29bbe /clang/lib/ExtractAPI/ExtractAPIConsumer.cpp | |
parent | a93ec06ae6277480b3f3d7521f867a7099e68fc1 (diff) | |
download | llvm-5301826fa86aa520b65c86abbe3b3a7194849e27.zip llvm-5301826fa86aa520b65c86abbe3b3a7194849e27.tar.gz llvm-5301826fa86aa520b65c86abbe3b3a7194849e27.tar.bz2 |
[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/lib/ExtractAPI/ExtractAPIConsumer.cpp')
-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 969ee77..4a97ee9 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); } |