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/SourceCode.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/SourceCode.cpp')
| -rw-r--r-- | clang-tools-extra/clangd/SourceCode.cpp | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/clang-tools-extra/clangd/SourceCode.cpp b/clang-tools-extra/clangd/SourceCode.cpp index b36d11d64a3..15403d215fc 100644 --- a/clang-tools-extra/clangd/SourceCode.cpp +++ b/clang-tools-extra/clangd/SourceCode.cpp @@ -224,14 +224,6 @@ bool isSpelledInSource(SourceLocation Loc, const SourceManager &SM) { return true; } -SourceLocation spellingLocIfSpelled(SourceLocation Loc, - const SourceManager &SM) { - if (!isSpelledInSource(Loc, SM)) - // Use the expansion location as spelling location is not interesting. - return SM.getExpansionRange(Loc).getBegin(); - return SM.getSpellingLoc(Loc); -} - llvm::Optional<Range> getTokenRange(const SourceManager &SM, const LangOptions &LangOpts, SourceLocation TokLoc) { |

