diff options
| author | Ilya Biryukov <ibiryukov@google.com> | 2018-03-12 15:28:22 +0000 |
|---|---|---|
| committer | Ilya Biryukov <ibiryukov@google.com> | 2018-03-12 15:28:22 +0000 |
| commit | 71028b83e7a8d98fd3cdbb75dd4e9b425560dc1e (patch) | |
| tree | 8a5ddca47c9a3950f7ea69ba0186e08dc35da1a5 /clang-tools-extra/clangd/SourceCode.cpp | |
| parent | ea2324f88225df30098abea9f89546c02d2f8337 (diff) | |
[clangd] Revamp handling of diagnostics.
Summary:
The new implementation attaches notes to diagnostic message and shows
the original diagnostics in the message of the note.
Reviewers: hokein, ioeric, sammccall
Reviewed By: sammccall
Subscribers: klimek, mgorny, cfe-commits, jkorous-apple
Differential Revision: https://reviews.llvm.org/D44142
llvm-svn: 327282
Diffstat (limited to 'clang-tools-extra/clangd/SourceCode.cpp')
| -rw-r--r-- | clang-tools-extra/clangd/SourceCode.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/SourceCode.cpp b/clang-tools-extra/clangd/SourceCode.cpp index 4495b537d696..191f3c24620f 100644 --- a/clang-tools-extra/clangd/SourceCode.cpp +++ b/clang-tools-extra/clangd/SourceCode.cpp @@ -48,5 +48,13 @@ Position sourceLocToPosition(const SourceManager &SM, SourceLocation Loc) { return P; } +Range halfOpenToRange(const SourceManager &SM, CharSourceRange R) { + // Clang is 1-based, LSP uses 0-based indexes. + Position Begin = sourceLocToPosition(SM, R.getBegin()); + Position End = sourceLocToPosition(SM, R.getEnd()); + + return {Begin, End}; +} + } // namespace clangd } // namespace clang |
