zixuw updated this revision to Diff 465505. zixuw added a comment. Update on top of the existing PrintingPolicy in the ASTContext instead of creating a new default one.
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().getPrintingPolicy(); + Policy.AnonymousTagLocations = false; + CI.getASTContext().setPrintingPolicy(Policy); + return std::make_unique<ExtractAPIConsumer>(CI.getASTContext(), std::move(LCF), *API); }
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().getPrintingPolicy(); + Policy.AnonymousTagLocations = false; + CI.getASTContext().setPrintingPolicy(Policy); + return std::make_unique<ExtractAPIConsumer>(CI.getASTContext(), std::move(LCF), *API); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits