Index: llvm/test/tools/llvm-ar/tool-name.test =================================================================== --- llvm/test/tools/llvm-ar/tool-name.test +++ llvm/test/tools/llvm-ar/tool-name.test @@ -7,9 +7,12 @@ # RUN: ln -s llvm-ar %t/ar.exe # RUN: ln -s llvm-ar %t/arm-pokymllib32-linux-gnueabi-llvm-ar-9 -# RUN: llvm-ar h | FileCheck %s -# RUN: %t/llvm-ar-9 h | FileCheck %s -# RUN: %t/ar.exe h | FileCheck %s -# RUN: %t/arm-pokymllib32-linux-gnueabi-llvm-ar-9 h | FileCheck %s +# RUN: llvm-ar h | FileCheck %s --check-prefix=DEFAULT +# RUN: %t/llvm-ar-9 h | FileCheck %s --check-prefix=VERSION +# RUN: %t/ar.exe h | FileCheck %s --check-prefix=SUFFIX +# RUN: %t/arm-pokymllib32-linux-gnueabi-llvm-ar-9 h | FileCheck %s --check-prefix=ARM -# CHECK: USAGE: llvm-ar +# DEFAULT: USAGE: llvm-ar{{ }} +# VERSION: USAGE: llvm-ar-9{{ }} +# SUFFIX: USAGE: ar{{ }} +# ARM: USAGE: arm-pokymllib32-linux-gnueabi-llvm-ar-9{{ }} Index: llvm/test/tools/llvm-ranlib/tool-name.test =================================================================== --- llvm/test/tools/llvm-ranlib/tool-name.test +++ llvm/test/tools/llvm-ranlib/tool-name.test @@ -6,8 +6,10 @@ # RUN: ln -s llvm-ranlib %t/llvm-ranlib-9 # RUN: ln -s llvm-ranlib %t/ranlib.exe -# RUN: llvm-ranlib -h | FileCheck %s -# RUN: %t/llvm-ranlib-9 -h | FileCheck %s -# RUN: %t/ranlib.exe -h | FileCheck %s +# RUN: llvm-ranlib -h | FileCheck %s --check-prefix=DEFAULT +# RUN: %t/llvm-ranlib-9 -h | FileCheck %s --check-prefix=VERSION +# RUN: %t/ranlib.exe -h | FileCheck %s --check-prefix=SUFFIX -# CHECK: USAGE: llvm-ranlib +# DEFAULT: USAGE: llvm-ranlib{{ }} +# VERSION: USAGE: llvm-ranlib-9{{ }} +# SUFFIX: USAGE: ranlib{{ }} Index: llvm/tools/llvm-ar/llvm-ar.cpp =================================================================== --- llvm/tools/llvm-ar/llvm-ar.cpp +++ llvm/tools/llvm-ar/llvm-ar.cpp @@ -62,25 +62,21 @@ // The basename of this program. static StringRef Stem; -const char RanlibHelp[] = R"(OVERVIEW: LLVM Ranlib (llvm-ranlib) - - This program generates an index to speed access to archives - -USAGE: llvm-ranlib - -OPTIONS: - -h --help - Display available options - -v --version - Display the version of this program - -D - Use zero for timestamps and uids/gids (default) - -U - Use actual timestamps and uids/gids -)"; - -const char ArHelp[] = R"(OVERVIEW: LLVM Archiver - -USAGE: llvm-ar [options] [-][modifiers] [relpos] [count] [files] - llvm-ar -M [\n\n" + << "OPTIONS:\n" + << " -h --help - Display available options\n" + << " -v --version - Display the version of this program\n" + << " -D - Use zero for timestamps and uids/gids " + "(default)\n" + << " -U - Use actual timestamps and uids/gids\n"; +} -OPTIONS: +static void printArHelp(StringRef ToolName) { + const char ArOptions[] = + R"(OPTIONS: --format - archive format to create =default - default =gnu - gnu @@ -127,11 +123,20 @@ [V] - display the version and exit )"; + outs() << "OVERVIEW: LLVM Archiver\n\n" + << "USAGE: " + ToolName + + " [options] [-][modifiers] [relpos] " + "[count] [files]\n" + << " " + ToolName + " -M [