[clang-tools-extra] r328199 - clang-tidy, modularize: return non-zero exit code on errors
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 22 07:18:20 PDT 2018
Author: alexfh
Date: Thu Mar 22 07:18:20 2018
New Revision: 328199
URL: http://llvm.org/viewvc/llvm-project?rev=328199&view=rev
Log:
clang-tidy, modularize: return non-zero exit code on errors
When no inputs given, the tools should not only produce the help message, but
also return a non-zero exit code. Fixed tests accordingly.
Modified:
clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
clang-tools-extra/trunk/modularize/Modularize.cpp
clang-tools-extra/trunk/test/clang-tidy/select-checks.cpp
clang-tools-extra/trunk/test/modularize/NoProblemsNamespace.modularize
Modified: clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp?rev=328199&r1=328198&r2=328199&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp Thu Mar 22 07:18:20 2018
@@ -424,13 +424,13 @@ static int clangTidyMain(int argc, const
if (EnabledChecks.empty()) {
llvm::errs() << "Error: no checks enabled.\n";
llvm::cl::PrintHelpMessage(/*Hidden=*/false, /*Categorized=*/true);
- return 0;
+ return 1;
}
if (PathList.empty()) {
llvm::errs() << "Error: no input files specified.\n";
llvm::cl::PrintHelpMessage(/*Hidden=*/false, /*Categorized=*/true);
- return 0;
+ return 1;
}
llvm::IntrusiveRefCntPtr<vfs::FileSystem> BaseFS(
VfsOverlay.empty() ? vfs::getRealFileSystem()
Modified: clang-tools-extra/trunk/modularize/Modularize.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/Modularize.cpp?rev=328199&r1=328198&r2=328199&view=diff
==============================================================================
--- clang-tools-extra/trunk/modularize/Modularize.cpp (original)
+++ clang-tools-extra/trunk/modularize/Modularize.cpp Thu Mar 22 07:18:20 2018
@@ -825,7 +825,7 @@ int main(int Argc, const char **Argv) {
// No go if we have no header list file.
if (ListFileNames.size() == 0) {
cl::PrintHelpMessage();
- return 0;
+ return 1;
}
std::unique_ptr<ModularizeUtilities> ModUtil;
Modified: clang-tools-extra/trunk/test/clang-tidy/select-checks.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/select-checks.cpp?rev=328199&r1=328198&r2=328199&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/select-checks.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/select-checks.cpp Thu Mar 22 07:18:20 2018
@@ -1,5 +1,5 @@
// RUN: clang-tidy %s -checks='-*,llvm-namespace-*' -- 2>&1 | FileCheck -implicit-check-not='{{warning:|error:}}' %s
-// RUN: clang-tidy %s -checks='-*,an-unknown-check' -- 2>&1 | FileCheck -implicit-check-not='{{warning:|error:}}' -check-prefix=CHECK2 %s
+// RUN: not clang-tidy %s -checks='-*,an-unknown-check' -- 2>&1 | FileCheck -implicit-check-not='{{warning:|error:}}' -check-prefix=CHECK2 %s
// CHECK2: Error: no checks enabled.
Modified: clang-tools-extra/trunk/test/modularize/NoProblemsNamespace.modularize
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/NoProblemsNamespace.modularize?rev=328199&r1=328198&r2=328199&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/modularize/NoProblemsNamespace.modularize (original)
+++ clang-tools-extra/trunk/test/modularize/NoProblemsNamespace.modularize Thu Mar 22 07:18:20 2018
@@ -1,3 +1,3 @@
-# RUN: modularize -block-check-header-list-only
+# RUN: modularize -block-check-header-list-only %s
Inputs/IncludeInNamespace.h
More information about the cfe-commits
mailing list