[all-commits] [llvm/llvm-project] 189aa5: [clangd] Adjust diagnostic range to be inside main...

kadir çetinkaya via All-commits all-commits at lists.llvm.org
Thu Jan 9 09:03:56 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 189aa5b7a4584677ad628ecc2c369db61d4d2515
      https://github.com/llvm/llvm-project/commit/189aa5b7a4584677ad628ecc2c369db61d4d2515
  Author: Kadir Cetinkaya <kadircet at google.com>
  Date:   2020-01-09 (Thu, 09 Jan 2020)

  Changed paths:
    M clang-tools-extra/clangd/Diagnostics.cpp
    M clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp

  Log Message:
  -----------
  [clangd] Adjust diagnostic range to be inside main file

Summary:
LSP requires diagnostics to lay inside main file. In clangd we keep
diagnostics in three different cases:
- already in main file
- adjusted to a header included in main file
- has a note covering some range in main file

In the last case, we were not adjusting the diagnostics range to be in main
file, therefore these diagnostics ended up pointing some arbitrary locations.

This patch fixes that issue by adjusting the range of diagnostics to be the
first note inside main file when converting to LSP.

Reviewers: ilya-biryukov

Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D72458




More information about the All-commits mailing list