[clangd] clangd --check: standalone diagnosis of common problems
authorSam McCall <sam.mccall@gmail.com>
Fri, 25 Sep 2020 20:25:03 +0000 (22:25 +0200)
committerSam McCall <sam.mccall@gmail.com>
Thu, 1 Oct 2020 13:47:47 +0000 (15:47 +0200)
commit79fbcbff41734e3d07e6200d33c3e40732dfae6a
tree2040497f155ff2d528983f889914915e32e72f58
parent5665ec4e182dba9965847d3698ad64a950bb00a7
[clangd] clangd --check: standalone diagnosis of common problems

This is a tool to simply parse a file as clangd would, and run some
common features (code actions, go-to-definition, hover) in an attempt to
trigger or reproduce crashes, error diagnostics, etc.

This is easier and more predictable than loading the file in clangd, because:
 - there's no editor/plugin variation to worry about
 - there's no accidental variation of user behavior or other extraneous requests
 - we trigger features at every token, rather than guessing
 - everything is synchronoous, logs are easier to reason about
 - it's easier to (get users to) capture logs when running on the command-line

This is a fairly lightweight variant of this idea.
We could do a lot more with it, and maybe we should.
But I can't in the near future, and experience will tell us if we made
the right tradeoffs and if it's worth investing further.

Differential Revision: https://reviews.llvm.org/D88338
clang-tools-extra/clangd/test/check-fail.test [new file with mode: 0644]
clang-tools-extra/clangd/test/check.test [new file with mode: 0644]
clang-tools-extra/clangd/tool/CMakeLists.txt
clang-tools-extra/clangd/tool/Check.cpp [new file with mode: 0644]
clang-tools-extra/clangd/tool/ClangdMain.cpp