diff --git a/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp b/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp --- a/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp +++ b/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp @@ -850,6 +850,11 @@ CI.getPreprocessor().addPPCallbacks(std::make_unique( 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(CI.getASTContext(), std::move(LCF), *API); }