summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clangd/TestTU.cpp
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2019-01-22 09:39:05 +0000
committerHaojian Wu <hokein@google.com>2019-01-22 09:39:05 +0000
commit1ca0c58c8152ecfb2a47f91080b64eae7710dadb (patch)
treecf967fe3f5caa6c4745dbf4a404a55b015d85cc5 /clang-tools-extra/unittests/clangd/TestTU.cpp
parentbd374b27cc33567b0a0522ee511fc1ea9f0bb1df (diff)
downloadbcm5719-llvm-1ca0c58c8152ecfb2a47f91080b64eae7710dadb.tar.gz
bcm5719-llvm-1ca0c58c8152ecfb2a47f91080b64eae7710dadb.zip
[clangd] Support clang-tidy configuration in clangd.
Summary: This patch adds some basic supports for clang-tidy configurations in clangd: - clangd will respect .clang-tidy configurations for each file - we don't aim to support all clang-tidy options in clangd, only a small subset of condfigurations (options related to which checks will be enabled) are supported. - add a `clang-tidy-checks` CLI option that can override options from .clang-tidy file Reviewers: ilya-biryukov, sammccall Reviewed By: sammccall Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D55256 llvm-svn: 351792
Diffstat (limited to 'clang-tools-extra/unittests/clangd/TestTU.cpp')
-rw-r--r--clang-tools-extra/unittests/clangd/TestTU.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/clangd/TestTU.cpp b/clang-tools-extra/unittests/clangd/TestTU.cpp
index 740c492297f..067d3f3f1d3 100644
--- a/clang-tools-extra/unittests/clangd/TestTU.cpp
+++ b/clang-tools-extra/unittests/clangd/TestTU.cpp
@@ -35,6 +35,8 @@ ParsedAST TestTU::build() const {
Inputs.CompileCommand.Directory = testRoot();
Inputs.Contents = Code;
Inputs.FS = buildTestFS({{FullFilename, Code}, {FullHeaderName, HeaderCode}});
+ Inputs.ClangTidyOpts = tidy::ClangTidyOptions::getDefaults();
+ Inputs.ClangTidyOpts.Checks = ClangTidyChecks;
auto PCHs = std::make_shared<PCHContainerOperations>();
auto CI = buildCompilerInvocation(Inputs);
assert(CI && "Failed to build compilation invocation.");
OpenPOWER on IntegriCloud