[all-commits] [llvm/llvm-project] 267675: [clangd] Add fixes for clang "include <foo.h>" dia...

Sam McCall via All-commits all-commits at lists.llvm.org
Wed Dec 8 07:17:07 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2676759bf22e45def4d37da74f09261b26a98d21
      https://github.com/llvm/llvm-project/commit/2676759bf22e45def4d37da74f09261b26a98d21
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2021-12-08 (Wed, 08 Dec 2021)

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

  Log Message:
  -----------
  [clangd] Add fixes for clang "include <foo.h>" diagnostics

Clang doesn't offer these fixes I guess for a couple of reasons:
 - where to insert includes is a formatting concern, and clang shouldn't
   depend on clang-format
 - the way clang prints diagnostics, we'd show a bunch of basically irrelevant
   context of "this is where we'd want to insert the include"

Maybe it's possible to hack around 1, but 2 is still a concern.
Meanwhile, bolting this onto include-fixer gets the job done.

Fixes https://github.com/clangd/clangd/issues/355
Fixes https://github.com/clangd/clangd/issues/937

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




More information about the All-commits mailing list