diff options
author | Haojian Wu <hokein@google.com> | 2019-06-25 08:01:46 +0000 |
---|---|---|
committer | Haojian Wu <hokein@google.com> | 2019-06-25 08:01:46 +0000 |
commit | 92c32574771465606807dea77c928c4d7768bbe9 (patch) | |
tree | 15d3417ce93b218d9382d50677b4cd797f79b2c3 /clang-tools-extra/clangd/SourceCode.h | |
parent | 303c9861e90cb9a15b15d31fab06d0374d42c9af (diff) | |
download | bcm5719-llvm-92c32574771465606807dea77c928c4d7768bbe9.tar.gz bcm5719-llvm-92c32574771465606807dea77c928c4d7768bbe9.zip |
[clangd] Cleanup the duplicated getTokenRange.
Summary:
Also lift it to SourceCode.h, so that it can be used in other places
(semantic code highlighting).
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63714
llvm-svn: 364280
Diffstat (limited to 'clang-tools-extra/clangd/SourceCode.h')
-rw-r--r-- | clang-tools-extra/clangd/SourceCode.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/SourceCode.h b/clang-tools-extra/clangd/SourceCode.h index 85db9458589..3ff67bc13cd 100644 --- a/clang-tools-extra/clangd/SourceCode.h +++ b/clang-tools-extra/clangd/SourceCode.h @@ -65,6 +65,11 @@ Position offsetToPosition(llvm::StringRef Code, size_t Offset); /// FIXME: This should return an error if the location is invalid. Position sourceLocToPosition(const SourceManager &SM, SourceLocation Loc); +/// Returns the taken range at \p TokLoc. +llvm::Optional<Range> getTokenRange(const SourceManager &SM, + const LangOptions &LangOpts, + SourceLocation TokLoc); + /// Return the file location, corresponding to \p P. Note that one should take /// care to avoid comparing the result with expansion locations. llvm::Expected<SourceLocation> sourceLocationInMainFile(const SourceManager &SM, |