This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Add command line option for ClangTidyConfig
AbandonedPublic

Authored by njames93 on Jun 16 2020, 3:21 PM.

Details

Summary

Adds a command line flag clang-tidy-config for specifing configuration of checks, in much the same way that clang-tidy does.

Diff Detail

Event Timeline

njames93 created this revision.Jun 16 2020, 3:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 16 2020, 3:21 PM

Good/bad news on timing here...

I'd like to introduce a config system (user config file, but also eventually in-project .clangd files, extensible over LSP etc).
It'll provide a generic way to apply different config to different files.
And it'll be YAML files on disk so it'll be simpler to supply such structured config (and still possible to provide config on the command-line).
I was literally going to send the design doc out today: http://tinyurl.com/clangd-config

This would replace most of our separate "user-pref"-like command-line flags (deprecate and maybe eventually remove).
As such I'm not sure introducing another one for fairly deep config is a good idea.

On the other hand, the scope for the config would be deliberately small for the LLVM 11 release, so we'd probably want to add clang-tidy config after the branch in a month, delaying it for one release cycle. How pressing is this?

Gotta say it's not hugely pressing.
The reason for it is clangd lets you specify some checks to run but it doesn't let you specify the options for those checks. Effectively forcing each project to require a .clang-tidy configuration file if you want to use checks where you require some configuration.
This isn't an issue on large scale established projects, but when starting out on small scale projects, it would be nice if clangd(tidy) was already set up how you like it without going through the need of setting up a .clang-tidy file.
Once D81949 lands it will also be useful on large scale projects that enforce certain tidy checks, but locally a developer may want extra configurable checks running in their editor.

Having said all of that your proposal does appear to do what this patch aims just in a much more user friendly way.

njames93 updated this revision to Diff 272009.Jun 19 2020, 4:30 AM

Small rebase

njames93 abandoned this revision.Jun 19 2020, 4:47 AM

Abandoned in favour of the proposed clangd-config.