[lld] r217409 - [mach-o] Fix so no options causes usage message to be printed
Nick Kledzik
kledzik at apple.com
Mon Sep 8 17:45:35 PDT 2014
Author: kledzik
Date: Mon Sep 8 19:45:35 2014
New Revision: 217409
URL: http://llvm.org/viewvc/llvm-project?rev=217409&view=rev
Log:
[mach-o] Fix so no options causes usage message to be printed
Added:
lld/trunk/test/mach-o/usage.yaml
Modified:
lld/trunk/lib/Driver/DarwinLdDriver.cpp
Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=217409&r1=217408&r2=217409&view=diff
==============================================================================
--- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Mon Sep 8 19:45:35 2014
@@ -253,7 +253,11 @@ bool DarwinLdDriver::parse(int argc, con
break;
}
if (arch == MachOLinkingContext::arch_unknown) {
- diagnostics << "error: -arch not specified and could not be inferred\n";
+ // If no -arch and no options at all, print usage message.
+ if (parsedArgs->size() == 0)
+ table.PrintHelp(llvm::outs(), argv[0], "LLVM Linker", false);
+ else
+ diagnostics << "error: -arch not specified and could not be inferred\n";
return false;
}
}
@@ -635,10 +639,6 @@ bool DarwinLdDriver::parse(int argc, con
}
if (!inputGraph->size()) {
- if (parsedArgs->size() == 0) {
- table.PrintHelp(llvm::outs(), "lld", "LLVM Linker", false);
- return false;
- }
diagnostics << "No input files\n";
return false;
}
Added: lld/trunk/test/mach-o/usage.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/mach-o/usage.yaml?rev=217409&view=auto
==============================================================================
--- lld/trunk/test/mach-o/usage.yaml (added)
+++ lld/trunk/test/mach-o/usage.yaml Mon Sep 8 19:45:35 2014
@@ -0,0 +1,8 @@
+# RUN: not lld -flavor darwin | FileCheck %s
+#
+# Test that running darwin linker with no option prints out usage message.
+#
+
+
+# CHECK: USAGE:
+# CHECK: -arch
More information about the llvm-commits
mailing list