HomePhabricator

[clangd] clangd --check: standalone diagnosis of common problems

Authored by sammccall on Sep 25 2020, 1:25 PM.

Description

[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