Skip to content

Commit 5301826

Browse files
committed
[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
1 parent a93ec06 commit 5301826

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clang/lib/ExtractAPI/ExtractAPIConsumer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,11 @@ ExtractAPIAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
850850
CI.getPreprocessor().addPPCallbacks(std::make_unique<MacroCallback>(
851851
CI.getSourceManager(), *LCF, *API, CI.getPreprocessor()));
852852

853+
// Do not include location in anonymous decls.
854+
PrintingPolicy Policy = CI.getASTContext().getPrintingPolicy();
855+
Policy.AnonymousTagLocations = false;
856+
CI.getASTContext().setPrintingPolicy(Policy);
857+
853858
return std::make_unique<ExtractAPIConsumer>(CI.getASTContext(),
854859
std::move(LCF), *API);
855860
}

0 commit comments

Comments
 (0)