[clang-tidy] adding "--config-file=<file-path>" to specify custom config file.
authorHiral Oza <hiral.oza@netapp.com>
Tue, 3 Nov 2020 10:11:44 +0000 (10:11 +0000)
committerDmitry Polukhin <dmitry.polukhin@gmail.com>
Tue, 3 Nov 2020 11:59:46 +0000 (11:59 +0000)
commitd6a468d622b2d48c40c47290aa54d6d910c5a6bf
treebc72b174925ef6ae16563203b5b4ac0981ace31d
parent1c068a01035ad63febd91fcc34148a4720c2045e
[clang-tidy] adding "--config-file=<file-path>" to specify custom config file.

Let clang-tidy to read config from specified file.
Example:
$ clang-tidy --config-file=/some/path/myTidyConfig --list-checks --
...this will read config from '/some/path/myTidyConfig'.

ClangTidyMain.cpp reads ConfigFile into string and then assigned read data to 'Config' i.e. makes like '--config' code flow internally.

May speed-up tidy runtime since now it will just look-up <file-path>
instead of searching ".clang-tidy" in parent-dir(s).

Directly specifying config path helps setting build dependencies.

Thanks to @DmitryPolukhin for valuable suggestion. This patch now propose
change only in ClangTidyMain.cpp.

Reviewed By: DmitryPolukhin

Differential Revision: https://reviews.llvm.org/D89936
clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
clang-tools-extra/test/clang-tidy/infrastructure/Inputs/config-file/config-file [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/infrastructure/config-file.cpp [new file with mode: 0644]