--- /dev/null
+## Show that help text is printed correctly when requested.
+
+# RUN: obj2yaml -h | FileCheck %s --check-prefixes=CHECK,CATEG --implicit-check-not=Options:
+# RUN: obj2yaml --help | FileCheck %s --check-prefixes=CHECK,CATEG --implicit-check-not=Options:
+# RUN: obj2yaml --help-list | FileCheck %s --implicit-check-not=Options:
+
+# CHECK: OVERVIEW: Dump a YAML description from an object file
+# CHECK: USAGE: obj2yaml{{(.exe)?}} [options] <input file>{{$}}
+# CHECK: OPTIONS:
+# CATEG: Generic Options:
+# CATEG: obj2yaml Options:
using namespace llvm;
using namespace llvm::object;
+static cl::OptionCategory Cat("obj2yaml Options");
+
static cl::opt<std::string>
InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"));
static cl::opt<std::string> OutputFilename("o", cl::desc("Output filename"),
cl::value_desc("filename"),
- cl::init("-"), cl::Prefix);
+ cl::init("-"), cl::Prefix,
+ cl::cat(Cat));
static cl::bits<RawSegments> RawSegment(
"raw-segment",
cl::desc("Mach-O: dump the raw contents of the listed segments instead of "
"parsing them:"),
- cl::values(clEnumVal(data, "__DATA"), clEnumVal(linkedit, "__LINKEDIT")));
+ cl::values(clEnumVal(data, "__DATA"), clEnumVal(linkedit, "__LINKEDIT")),
+ cl::cat(Cat));
static Error dumpObject(const ObjectFile &Obj, raw_ostream &OS) {
if (Obj.isCOFF())
int main(int argc, char *argv[]) {
InitLLVM X(argc, argv);
- cl::ParseCommandLineOptions(argc, argv);
+ cl::HideUnrelatedOptions(Cat);
+ cl::ParseCommandLineOptions(
+ argc, argv, "Dump a YAML description from an object file", nullptr,
+ nullptr, /*LongOptionsUseDoubleDash=*/true);
std::error_code EC;
std::unique_ptr<ToolOutputFile> Out(