diff options
| author | Ilya Biryukov <ibiryukov@google.com> | 2019-12-10 10:08:39 +0100 |
|---|---|---|
| committer | Ilya Biryukov <ibiryukov@google.com> | 2019-12-10 10:22:43 +0100 |
| commit | b63c35ebf76ca0ac89405aeadee2b98a0e91e05e (patch) | |
| tree | 4c5faffa7550bd0c1b6c8e280f331b0a246aa709 /clang-tools-extra/clangd/index/SymbolCollector.cpp | |
| parent | dbf520f617440d62ca46f64cdc41159945911902 (diff) | |
| download | bcm5719-llvm-b63c35ebf76ca0ac89405aeadee2b98a0e91e05e.tar.gz bcm5719-llvm-b63c35ebf76ca0ac89405aeadee2b98a0e91e05e.zip | |
[clangd] Simplify code using findName. NFC
`findName` was always used in conjuction with `spellingLocIfSpelled`.
This patch replaces patterns of the form:
spellingLocIfSpelled(findName(&ND), SM)
With a new helper function:
nameLocation(ND, SM)
And removes `spellingLocIfSpelled` and `findName`. Both are never used
anywhere else and the latter is an equivalent of `Decl::getLocation` if
we ever need it again.
Diffstat (limited to 'clang-tools-extra/clangd/index/SymbolCollector.cpp')
| -rw-r--r-- | clang-tools-extra/clangd/index/SymbolCollector.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp index 6775ccc5bc1..ac782c07c7a 100644 --- a/clang-tools-extra/clangd/index/SymbolCollector.cpp +++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp @@ -82,7 +82,7 @@ static const char *PROTO_HEADER_COMMENT = // filters. bool isPrivateProtoDecl(const NamedDecl &ND) { const auto &SM = ND.getASTContext().getSourceManager(); - auto Loc = spellingLocIfSpelled(findName(&ND), SM); + auto Loc = nameLocation(ND, SM); auto FileName = SM.getFilename(Loc); if (!FileName.endswith(".proto.h") && !FileName.endswith(".pb.h")) return false; @@ -595,7 +595,7 @@ const Symbol *SymbolCollector::addDeclaration(const NamedDecl &ND, SymbolID ID, S.Flags |= Symbol::VisibleOutsideFile; S.SymInfo = index::getSymbolInfo(&ND); std::string FileURI; - auto Loc = spellingLocIfSpelled(findName(&ND), SM); + auto Loc = nameLocation(ND, SM); assert(Loc.isValid() && "Invalid source location for NamedDecl"); // FIXME: use the result to filter out symbols. shouldIndexFile(SM.getFileID(Loc)); @@ -656,7 +656,7 @@ void SymbolCollector::addDefinition(const NamedDecl &ND, Symbol S = DeclSym; std::string FileURI; const auto &SM = ND.getASTContext().getSourceManager(); - auto Loc = spellingLocIfSpelled(findName(&ND), SM); + auto Loc = nameLocation(ND, SM); // FIXME: use the result to filter out symbols. shouldIndexFile(SM.getFileID(Loc)); if (auto DefLoc = |

