[llvm] r361750 - Make llvm-as --help great again

Serge Guelton via llvm-commits llvm-commits at lists.llvm.org
Mon May 27 01:24:06 PDT 2019

Author: serge_sans_paille
Date: Mon May 27 01:24:06 2019
New Revision: 361750

URL: http://llvm.org/viewvc/llvm-project?rev=361750&view=rev
Make llvm-as --help great again

This is a follow-up to https://reviews.llvm.org/D60411, but for llvm-as.

New output:

    OVERVIEW: llvm .ll -> .bc assembler

    USAGE: llvm-as [options] <input .llvm file>


    Generic Options:

      -help                        - Display available options (-help-hidden for more)
      -help-list                   - Display list of available options (-help-list-hidden for more)
      -version                     - Display the version of this program

    llvm-as Options:

      -data-layout=<layout-string> - data layout string to use
      -disable-output              - Disable output
      -f                           - Enable binary output on terminals
      -module-hash                 - Emit module hash
      -o=<filename>                - Override output filename

Differential Revision: https://reviews.llvm.org/D60603


Added: llvm/trunk/test/tools/llvm-as/help.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-as/help.test?rev=361750&view=auto
--- llvm/trunk/test/tools/llvm-as/help.test (added)
+++ llvm/trunk/test/tools/llvm-as/help.test Mon May 27 01:24:06 2019
@@ -0,0 +1,3 @@
+RUN: llvm-as --help 2>&1 | FileCheck --implicit-check-not="General Options:" %s
+CHECK: Generic Options:
+CHECK: llvm-as Options:

Added: llvm/trunk/test/tools/llvm-as/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-as/lit.local.cfg?rev=361750&view=auto
--- llvm/trunk/test/tools/llvm-as/lit.local.cfg (added)
+++ llvm/trunk/test/tools/llvm-as/lit.local.cfg Mon May 27 01:24:06 2019
@@ -0,0 +1,4 @@
+if not 'X86' in config.root.targets:
+    config.unsupported = True
+config.suffixes = ['.ll', '.s', '.test', '.yaml']

Modified: llvm/trunk/tools/llvm-as/llvm-as.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-as/llvm-as.cpp?rev=361750&r1=361749&r2=361750&view=diff
--- llvm/trunk/tools/llvm-as/llvm-as.cpp (original)
+++ llvm/trunk/tools/llvm-as/llvm-as.cpp Mon May 27 01:24:06 2019
@@ -30,38 +30,43 @@
 #include <memory>
 using namespace llvm;
+cl::OptionCategory AsCat("llvm-as Options");
 static cl::opt<std::string> InputFilename(cl::Positional,
                                           cl::desc("<input .llvm file>"),
 static cl::opt<std::string> OutputFilename("o",
                                            cl::desc("Override output filename"),
-                                           cl::value_desc("filename"));
+                                           cl::value_desc("filename"),
+                                           cl::cat(AsCat));
-static cl::opt<bool> Force("f", cl::desc("Enable binary output on terminals"));
+static cl::opt<bool> Force("f", cl::desc("Enable binary output on terminals"),
+                           cl::cat(AsCat));
 static cl::opt<bool> DisableOutput("disable-output", cl::desc("Disable output"),
-                                   cl::init(false));
+                                   cl::init(false), cl::cat(AsCat));
 static cl::opt<bool> EmitModuleHash("module-hash", cl::desc("Emit module hash"),
-                                    cl::init(false));
+                                    cl::init(false), cl::cat(AsCat));
 static cl::opt<bool> DumpAsm("d", cl::desc("Print assembly as parsed"),
-                             cl::Hidden);
+                             cl::Hidden, cl::cat(AsCat));
 static cl::opt<bool>
     DisableVerify("disable-verify", cl::Hidden,
-                  cl::desc("Do not run verifier on input LLVM (dangerous!)"));
+                  cl::desc("Do not run verifier on input LLVM (dangerous!)"),
+                  cl::cat(AsCat));
 static cl::opt<bool> PreserveBitcodeUseListOrder(
     cl::desc("Preserve use-list order when writing LLVM bitcode."),
-    cl::init(true), cl::Hidden);
+    cl::init(true), cl::Hidden, cl::cat(AsCat));
 static cl::opt<std::string> ClDataLayout("data-layout",
                                          cl::desc("data layout string to use"),
-                                         cl::init(""));
+                                         cl::init(""), cl::cat(AsCat));
 static void WriteOutputFile(const Module *M, const ModuleSummaryIndex *Index) {
   // Infer the output filename if needed.
@@ -109,6 +114,7 @@ static void WriteOutputFile(const Module
 int main(int argc, char **argv) {
   InitLLVM X(argc, argv);
   LLVMContext Context;
+  cl::HideUnrelatedOptions(AsCat);
   cl::ParseCommandLineOptions(argc, argv, "llvm .ll -> .bc assembler\n");
   // Parse the file now...

More information about the llvm-commits mailing list