forked from OSchip/llvm-project
Exit with error when no checks enabled.
Summary: This seems like a more appropriate reaction to the user specifying a single check with a wrong name, for example. Reviewers: klimek Reviewed By: klimek Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3981 llvm-svn: 210043
This commit is contained in:
parent
5ce26687f2
commit
fbf9258582
|
@ -119,15 +119,23 @@ int main(int argc, const char **argv) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
std::vector<std::string> EnabledChecks = clang::tidy::getCheckNames(Options);
|
||||
|
||||
// FIXME: Allow using --list-checks without positional arguments.
|
||||
if (ListChecks) {
|
||||
llvm::outs() << "Enabled checks:";
|
||||
for (auto CheckName : clang::tidy::getCheckNames(Options))
|
||||
for (auto CheckName : EnabledChecks)
|
||||
llvm::outs() << "\n " << CheckName;
|
||||
llvm::outs() << "\n\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (EnabledChecks.empty()) {
|
||||
llvm::errs() << "Error: no checks enabled.\n";
|
||||
llvm::cl::PrintHelpMessage(/*Hidden=*/false, /*Categorized=*/true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::vector<clang::tidy::ClangTidyError> Errors;
|
||||
clang::tidy::ClangTidyStats Stats =
|
||||
clang::tidy::runClangTidy(Options, OptionsParser.getCompilations(),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUN: clang-tidy %s.nonexistent.cpp -- | FileCheck -check-prefix=CHECK1 %s
|
||||
// RUN: clang-tidy -checks='google-explicit-constructor' %s -- -fan-unknown-option | FileCheck -check-prefix=CHECK2 %s
|
||||
// RUN: clang-tidy -checks='-*,google-explicit-constructor,clang-diagnostic-literal-conversion' %s -- -fan-unknown-option | FileCheck -check-prefix=CHECK3 %s
|
||||
// RUN: clang-tidy -checks='-*,clang-diagnostic-macro-redefined' %s -- -DMACRO_FROM_COMMAND_LINE | FileCheck -check-prefix=CHECK4 %s
|
||||
// RUN: clang-tidy -checks='-*,misc-use-override,clang-diagnostic-macro-redefined' %s -- -DMACRO_FROM_COMMAND_LINE | FileCheck -check-prefix=CHECK4 %s
|
||||
|
||||
// CHECK1-NOT: warning
|
||||
// CHECK2-NOT: warning
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
|
||||
// RUN: clang-tidy %t.cpp -fix -checks='-*,llvm-*' --
|
||||
// RUN: FileCheck -input-file=%t.cpp %s
|
||||
// RUN: clang-tidy %s -checks='-*,an-unknown-check' -- 2>&1 | FileCheck -check-prefix=CHECK2 %s
|
||||
|
||||
// CHECK2: Error: no checks enabled.
|
||||
|
||||
namespace i {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue