[PATCH] D67560: [llvm-ar] Add operation 'h': display help and exit

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 09:15:13 PDT 2019


MaskRay created this revision.
MaskRay added reviewers: gbreynoo, grimar, jhenderson, rupprecht.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Operation 'h' is undocumented in GNU as. `llvm-ar h` may be what users
try at first if they have the impression that operations are usually not
prepended by a dash.


Repository:
  rL LLVM

https://reviews.llvm.org/D67560

Files:
  test/tools/llvm-ar/help-message.test
  tools/llvm-ar/llvm-ar.cpp


Index: tools/llvm-ar/llvm-ar.cpp
===================================================================
--- tools/llvm-ar/llvm-ar.cpp
+++ tools/llvm-ar/llvm-ar.cpp
@@ -283,6 +283,10 @@
 
   for (unsigned i = 0; i < Options.size(); ++i) {
     switch (Options[i]) {
+    case 'h':
+      printHelpMessage();
+      exit(0);
+      break;
     case 'd':
       ++NumOperations;
       Operation = Delete;
Index: test/tools/llvm-ar/help-message.test
===================================================================
--- /dev/null
+++ test/tools/llvm-ar/help-message.test
@@ -0,0 +1,5 @@
+# RUN: llvm-ar -h | FileCheck %s
+# RUN: llvm-ar --help | FileCheck %s
+# RUN: llvm-ar h | FileCheck %s
+
+# CHECK: USAGE: llvm-ar


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67560.220121.patch
Type: text/x-patch
Size: 715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190913/97ff4553/attachment.bin>


More information about the llvm-commits mailing list