[llvm-ar] Fix lib.exe detection when running within MSVC toolchain

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

llvm-svn: 329658
This commit is contained in:
Alexandre Ganea 2018-04-10 01:50:25 +00:00
parent 19618fc639
commit 76a0154ce5
2 changed files with 17 additions and 6 deletions

View File

@ -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)

View File

@ -109,9 +109,9 @@ MODIFIERS (generic):
)";
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 @@ int main(int argc, char **argv) {
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!");
}