[clang-tidy] Make the plugin honor NOLINT
authorNikolai Kosjar <nikolai.kosjar@qt.io>
Thu, 6 Jun 2019 13:13:27 +0000 (13:13 +0000)
committerNikolai Kosjar <nikolai.kosjar@qt.io>
Thu, 6 Jun 2019 13:13:27 +0000 (13:13 +0000)
commit60e1296a9a36186656989d8223b60b6d4cb67b34
treed789fa62cfa96907c7b4d1f195cac9f0849e094c
parentdf95e6109e1cac8716bfc62ecf4500ed7420ecda
[clang-tidy] Make the plugin honor NOLINT

Instantiate a ClangTidyDiagnosticConsumer also for the plugin case and
let it forward the diagnostics to the external diagnostic engine that is
already in place.

One minor difference to the clang-tidy executable case is that the
compiler checks/diagnostics are referred to with their original name.
For example, for -Wunused-variable the plugin will refer to the check as
"-Wunused-variable" while the clang-tidy executable will refer to that
as "clang-diagnostic- unused-variable". This is because the compiler
diagnostics never reach ClangTidyDiagnosticConsumer.

Differential Revision: https://reviews.llvm.org/D61487

llvm-svn: 362702
clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp
clang-tools-extra/test/clang-tidy/basic.cpp
clang-tools-extra/test/clang-tidy/nolint-plugin.cpp [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/nolintnextline-plugin.cpp [new file with mode: 0644]