[PATCH] D119842: [clangd] NFC: Cleanup IncludeCleaner API

2022-03-08 Thread Kirill Bobyrev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd5106c8f973b: [clangd] NFC: Cleanup IncludeCleaner API 
(authored by kbobyrev).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119842/new/

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
@@ -286,11 +286,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)
@@ -299,8 +299,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
@@ -286,11 +286,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)
@@ -299,8 +299,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


[PATCH] D119842: [clangd] NFC: Cleanup IncludeCleaner API

2022-03-08 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.
Herald added a project: All.

Not sure how I missed this patch, sorry!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119842/new/

https://reviews.llvm.org/D119842

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D119842: [clangd] NFC: Cleanup IncludeCleaner API

2022-02-15 Thread Kirill Bobyrev via Phabricator via cfe-commits
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