kbobyrev created this revision. kbobyrev added a reviewer: sammccall. Herald added subscribers: usaxena95, kadircet, arphaman. kbobyrev requested review of this revision. Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov. Herald added a project: clang-tools-extra.
Make a further improvement to decrease verbosity of the API: ASTContext provides SourceManager access. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D119842 Files: clang-tools-extra/clangd/IncludeCleaner.cpp clang-tools-extra/clangd/IncludeCleaner.h Index: clang-tools-extra/clangd/IncludeCleaner.h =================================================================== --- clang-tools-extra/clangd/IncludeCleaner.h +++ clang-tools-extra/clangd/IncludeCleaner.h @@ -51,8 +51,7 @@ /// - don't attempt to describe where symbols were referenced from in /// ambiguous cases (e.g. implicitly used symbols, multiple declarations) /// - err on the side of reporting all possible locations -ReferencedLocations findReferencedLocations(const SourceManager &SM, - ASTContext &Ctx, Preprocessor &PP, +ReferencedLocations findReferencedLocations(ASTContext &Ctx, Preprocessor &PP, const syntax::TokenBuffer *Tokens); ReferencedLocations findReferencedLocations(ParsedAST &AST); Index: clang-tools-extra/clangd/IncludeCleaner.cpp =================================================================== --- clang-tools-extra/clangd/IncludeCleaner.cpp +++ clang-tools-extra/clangd/IncludeCleaner.cpp @@ -288,11 +288,11 @@ } // namespace -ReferencedLocations findReferencedLocations(const SourceManager &SM, - ASTContext &Ctx, Preprocessor &PP, +ReferencedLocations findReferencedLocations(ASTContext &Ctx, Preprocessor &PP, const syntax::TokenBuffer *Tokens) { trace::Span Tracer("IncludeCleaner::findReferencedLocations"); ReferencedLocations Result; + const auto &SM = Ctx.getSourceManager(); ReferencedLocationCrawler Crawler(Result, SM); Crawler.TraverseAST(Ctx); if (Tokens) @@ -301,8 +301,8 @@ } ReferencedLocations findReferencedLocations(ParsedAST &AST) { - return findReferencedLocations(AST.getSourceManager(), AST.getASTContext(), - AST.getPreprocessor(), &AST.getTokens()); + return findReferencedLocations(AST.getASTContext(), AST.getPreprocessor(), + &AST.getTokens()); } ReferencedFiles
Index: clang-tools-extra/clangd/IncludeCleaner.h =================================================================== --- clang-tools-extra/clangd/IncludeCleaner.h +++ clang-tools-extra/clangd/IncludeCleaner.h @@ -51,8 +51,7 @@ /// - don't attempt to describe where symbols were referenced from in /// ambiguous cases (e.g. implicitly used symbols, multiple declarations) /// - err on the side of reporting all possible locations -ReferencedLocations findReferencedLocations(const SourceManager &SM, - ASTContext &Ctx, Preprocessor &PP, +ReferencedLocations findReferencedLocations(ASTContext &Ctx, Preprocessor &PP, const syntax::TokenBuffer *Tokens); ReferencedLocations findReferencedLocations(ParsedAST &AST); Index: clang-tools-extra/clangd/IncludeCleaner.cpp =================================================================== --- clang-tools-extra/clangd/IncludeCleaner.cpp +++ clang-tools-extra/clangd/IncludeCleaner.cpp @@ -288,11 +288,11 @@ } // namespace -ReferencedLocations findReferencedLocations(const SourceManager &SM, - ASTContext &Ctx, Preprocessor &PP, +ReferencedLocations findReferencedLocations(ASTContext &Ctx, Preprocessor &PP, const syntax::TokenBuffer *Tokens) { trace::Span Tracer("IncludeCleaner::findReferencedLocations"); ReferencedLocations Result; + const auto &SM = Ctx.getSourceManager(); ReferencedLocationCrawler Crawler(Result, SM); Crawler.TraverseAST(Ctx); if (Tokens) @@ -301,8 +301,8 @@ } ReferencedLocations findReferencedLocations(ParsedAST &AST) { - return findReferencedLocations(AST.getSourceManager(), AST.getASTContext(), - AST.getPreprocessor(), &AST.getTokens()); + return findReferencedLocations(AST.getASTContext(), AST.getPreprocessor(), + &AST.getTokens()); } ReferencedFiles
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits