Index: llvm/trunk/test/tools/llvm-ar/case-detection.test =================================================================== --- llvm/trunk/test/tools/llvm-ar/case-detection.test +++ llvm/trunk/test/tools/llvm-ar/case-detection.test @@ -0,0 +1,11 @@ +-- Test CamelCase tool name to ensure detection works properly + +RUN: yaml2obj %S/Inputs/coff.yaml -o %t.obj +RUN: rm -rf %t1 +RUN: mkdir %t1 +RUN: cp llvm-ar %t1/Lib +RUN: %t1/Lib /OUT:%t.lib %t.obj | FileCheck %s -allow-empty +RUN: cp llvm-ar %t1/Ar +RUN: %t1/Ar crs %t.ar %t.obj | FileCheck %s -allow-empty + +CHECK-NOT: OVERVIEW: LLVM Archiver (llvm-ar) Index: llvm/trunk/tools/llvm-ar/llvm-ar.cpp =================================================================== --- llvm/trunk/tools/llvm-ar/llvm-ar.cpp +++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp @@ -109,9 +109,9 @@ )"; void printHelpMessage() { - if (Stem.find("ranlib") != StringRef::npos) + if (Stem.find_lower("ranlib") != StringRef::npos) outs() << RanlibHelp; - else if (Stem.find("ar") != StringRef::npos) + else if (Stem.find_lower("ar") != StringRef::npos) outs() << ArHelp; } @@ -960,16 +960,16 @@ llvm::InitializeAllAsmParsers(); Stem = sys::path::stem(ToolName); - if (Stem.find("dlltool") != StringRef::npos) + if (Stem.find_lower("dlltool") != StringRef::npos) return dlltoolDriverMain(makeArrayRef(argv, argc)); - if (Stem.find("ranlib") != StringRef::npos) + if (Stem.find_lower("ranlib") != StringRef::npos) return ranlib_main(argc, argv); - if (Stem.find("lib") != StringRef::npos) + if (Stem.find_lower("lib") != StringRef::npos) return libDriverMain(makeArrayRef(argv, argc)); - if (Stem.find("ar") != StringRef::npos) + if (Stem.find_lower("ar") != StringRef::npos) return ar_main(argc, argv); fail("Not ranlib, ar, lib or dlltool!"); }