CommandLine: Exit successfully for -version and -help
authorJustin Bogner <mail@justinbogner.com>
Fri, 28 Feb 2014 19:08:01 +0000 (19:08 +0000)
committerJustin Bogner <mail@justinbogner.com>
Fri, 28 Feb 2014 19:08:01 +0000 (19:08 +0000)
Tools that use the CommandLine library currently exit with an error
when invoked with -version or -help. This is unusual and non-standard,
so we'll fix them to exit successfully instead.

I don't expect that anyone relies on the current behaviour, so this
should be a fairly safe change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202530 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/CommandLine.cpp
test/CodeGen/Generic/print-after.ll

index e1317a25986d918c8761824b1cf856cc6475543b..9e807265878ca17dd4d80f0825f1bdfc9c68f537 100644 (file)
@@ -1496,7 +1496,7 @@ public:
     MoreHelp->clear();
 
     // Halt the program since help information was printed
-    exit(1);
+    exit(0);
   }
 };
 
@@ -1732,7 +1732,7 @@ public:
 
     if (OverrideVersionPrinter != 0) {
       (*OverrideVersionPrinter)();
-      exit(1);
+      exit(0);
     }
     print();
 
@@ -1746,7 +1746,7 @@ public:
         (*I)();
     }
 
-    exit(1);
+    exit(0);
   }
 };
 } // End anonymous namespace
index 7505907ef773396ae6bc7b32256445c9b0e55e7f..1b7ce84a8a54d4d28e0fa0bb897810821d164e19 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: not llc --help-hidden 2>&1 | FileCheck %s
+; RUN: llc --help-hidden 2>&1 | FileCheck %s
 
 ; CHECK: -print-after
 ; CHECK-NOT: -print-after-all