zixuw updated this revision to Diff 465486. zixuw added a comment. Set PrintingPolicy properly
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().getLangOpts()); + 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().getLangOpts()); + 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