[clang-tools-extra] r343849 - [clangd] Remove last usage of ast matchers from SymbolCollector. NFC

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 5 07:03:05 PDT 2018


Author: sammccall
Date: Fri Oct  5 07:03:04 2018
New Revision: 343849

URL: http://llvm.org/viewvc/llvm-project?rev=343849&view=rev
Log:
[clangd] Remove last usage of ast matchers from SymbolCollector. NFC

Modified:
    clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp

Modified: clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp?rev=343849&r1=343848&r2=343849&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/SymbolCollector.cpp Fri Oct  5 07:03:04 2018
@@ -19,7 +19,6 @@
 #include "clang/AST/DeclBase.h"
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclTemplate.h"
-#include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Index/IndexSymbol.h"
@@ -229,10 +228,10 @@ getTokenLocation(SourceLocation TokLoc,
 // the first seen declaration as canonical declaration is not a good enough
 // heuristic.
 bool isPreferredDeclaration(const NamedDecl &ND, index::SymbolRoleSet Roles) {
-  using namespace clang::ast_matchers;
+  const auto& SM = ND.getASTContext().getSourceManager();
   return (Roles & static_cast<unsigned>(index::SymbolRole::Definition)) &&
          llvm::isa<TagDecl>(&ND) &&
-         match(decl(isExpansionInMainFile()), ND, ND.getASTContext()).empty();
+         !SM.isWrittenInMainFile(SM.getExpansionLoc(ND.getLocation()));
 }
 
 RefKind toRefKind(index::SymbolRoleSet Roles) {
@@ -260,7 +259,6 @@ void SymbolCollector::initialize(ASTCont
 bool SymbolCollector::shouldCollectSymbol(const NamedDecl &ND,
                                           ASTContext &ASTCtx,
                                           const Options &Opts) {
-  using namespace clang::ast_matchers;
   if (ND.isImplicit())
     return false;
   // Skip anonymous declarations, e.g (anonymous enum/class/struct).




More information about the cfe-commits mailing list