[clang-tools-extra] r312769 - Update for PrintHelpMessage not calling exit.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 10 08:44:33 PDT 2017


On Fri, Sep 8, 2017 at 2:33 AM, Rafael Espindola via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: rafael
> Date: Thu Sep  7 17:33:39 2017
> New Revision: 312769
>
> URL: http://llvm.org/viewvc/llvm-project?rev=312769&view=rev
> Log:
> Update for PrintHelpMessage not calling exit.
>
> Modified:
>     clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp
>     clang-tools-extra/trunk/modularize/Modularize.cpp
>
> 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=312769&
> r1=312768&r2=312769&view=diff
> ============================================================
> ==================
> --- clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp (original)
> +++ clang-tools-extra/trunk/clang-tidy/tool/ClangTidyMain.cpp Thu Sep  7
> 17:33:39 2017
> @@ -392,13 +392,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 1;
> +    return 0;
>    }
>
>    if (PathList.empty()) {
>      llvm::errs() << "Error: no input files specified.\n";
>      llvm::cl::PrintHelpMessage(/*Hidden=*/false, /*Categorized=*/true);
> -    return 1;
> +    return 0;
>    }
>

Actually, both of these should return non-zero exit code, since these code
paths are executed when the command line arguments are incorrect. Or am I
missing something?


>
>    ProfileData Profile;
>
> Modified: clang-tools-extra/trunk/modularize/Modularize.cpp
> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/
> trunk/modularize/Modularize.cpp?rev=312769&r1=312768&r2=312769&view=diff
> ============================================================
> ==================
> --- clang-tools-extra/trunk/modularize/Modularize.cpp (original)
> +++ clang-tools-extra/trunk/modularize/Modularize.cpp Thu Sep  7 17:33:39
> 2017
> @@ -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 1;
> +    return 0;
>

IIUC, this path is also corresponds to incorrect command line arguments.


>    }
>
>    std::unique_ptr<ModularizeUtilities> ModUtil;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170910/67a77961/attachment.html>


More information about the cfe-commits mailing list