[clangd] IncludeCleaner as a library: Find all references to symbols in the file
authorKirill Bobyrev <kbobyrev@google.com>
Wed, 18 Aug 2021 08:08:08 +0000 (10:08 +0200)
committerKirill Bobyrev <kbobyrev@google.com>
Wed, 18 Aug 2021 08:08:35 +0000 (10:08 +0200)
commitd1ec581ebfca9bd455ae1a467b2d4b52fc59092b
tree312f0db7df249eb298e1516336a393b2d25809c2
parent0104cc85b14aad7980360f58a1159463f8da5adb
[clangd] IncludeCleaner as a library: Find all references to symbols in the file

This is the first patch in an ongoing attempt of Include Cleaner: unused/missing
headere diagnostics, an IWYU-like functionality implementation for clangd. The
work is split into (mostly) distinct and parallelizable pieces:

- Finding all referenced locations (this patch).
- Finding all referenced locations of macros.
- Building IncludeGraph and marking headers as unused, used and directly used.
- Making use of the introduced library and add an option to use in clangd.

---

* Adding support for standard library headers (possibly through mapping
  genfiles).

Based on https://reviews.llvm.org/D100540.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D105426
clang-tools-extra/clangd/CMakeLists.txt
clang-tools-extra/clangd/IncludeCleaner.cpp [new file with mode: 0644]
clang-tools-extra/clangd/IncludeCleaner.h [new file with mode: 0644]
clang-tools-extra/clangd/unittests/CMakeLists.txt
clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp [new file with mode: 0644]