<div dir="ltr">It started failing with the following error. Can you take a look?<div><pre style="color:rgb(0,0,0)">-- Testing: 996 tests, 40 threads --
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90
FAIL: lld-Unit :: DriverTests/DriverTests/DarwinLdParserTest.llvmOptions (937 of 996)
******************** TEST 'lld-Unit :: DriverTests/DriverTests/DarwinLdParserTest.llvmOptions' FAILED ********************
Note: Google Test filter = DarwinLdParserTest.llvmOptions
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from DarwinLdParserTest
[ RUN      ] DarwinLdParserTest.llvmOptions
lld (LLVM option parsing): Unknown command line argument '-debug-only'.  Try: 'lld (LLVM option parsing) -help'
lld (LLVM option parsing): Did you mean '-debug-pass'?
lld (LLVM option parsing): Unknown command line argument 'foo'.  Try: 'lld (LLVM option parsing) -help'</pre></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 16, 2015 at 12:53 PM, Pete Cooper via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: pete<br>
Date: Wed Dec 16 14:53:27 2015<br>
New Revision: 255819<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=255819&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=255819&view=rev</a><br>
Log:<br>
Move parsing of LLVM options to parse() method.<br>
<br>
We used to parse the LLVM options in Driver::link.  However, that is<br>
after parse() where we load files.  By moving the LLVM option handling<br>
earlier, we can add DEBUG() to code such as MachONormalizedFileToAtoms.cpp<br>
and have it enabled correctly by '-mllvm --debug'.<br>
<br>
Modified:<br>
    lld/trunk/include/lld/Driver/Driver.h<br>
    lld/trunk/lib/Driver/CoreDriver.cpp<br>
    lld/trunk/lib/Driver/DarwinLdDriver.cpp<br>
    lld/trunk/lib/Driver/Driver.cpp<br>
    lld/trunk/lib/Driver/GnuLdDriver.cpp<br>
<br>
Modified: lld/trunk/include/lld/Driver/Driver.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/Driver.h?rev=255819&r1=255818&r2=255819&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/Driver.h?rev=255819&r1=255818&r2=255819&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/include/lld/Driver/Driver.h (original)<br>
+++ lld/trunk/include/lld/Driver/Driver.h Wed Dec 16 14:53:27 2015<br>
@@ -46,6 +46,9 @@ protected:<br>
   static bool link(LinkingContext &context,<br>
                    raw_ostream &diag = llvm::errs());<br>
<br>
+  /// Parses the LLVM options from the context.<br>
+  static void parseLLVMOptions(const LinkingContext &context);<br>
+<br>
 private:<br>
   Driver() = delete;<br>
 };<br>
<br>
Modified: lld/trunk/lib/Driver/CoreDriver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CoreDriver.cpp?rev=255819&r1=255818&r2=255819&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CoreDriver.cpp?rev=255819&r1=255818&r2=255819&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/Driver/CoreDriver.cpp (original)<br>
+++ lld/trunk/lib/Driver/CoreDriver.cpp Wed Dec 16 14:53:27 2015<br>
@@ -159,6 +159,8 @@ bool CoreDriver::parse(llvm::ArrayRef<co<br>
     }<br>
   }<br>
<br>
+  parseLLVMOptions(ctx);<br>
+<br>
   if (ctx.getNodes().empty()) {<br>
     diagnostics << "No input files\n";<br>
     return false;<br>
<br>
Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=255819&r1=255818&r2=255819&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=255819&r1=255818&r2=255819&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)<br>
+++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Wed Dec 16 14:53:27 2015<br>
@@ -822,6 +822,10 @@ bool DarwinLdDriver::parse(llvm::ArrayRe<br>
     }<br>
   }<br>
<br>
+  // Parse the LLVM options before we process files in case the file handling<br>
+  // makes use of things like DEBUG().<br>
+  parseLLVMOptions(ctx);<br>
+<br>
   // Handle input files and sectcreate.<br>
   for (auto &arg : parsedArgs) {<br>
     bool upward;<br>
<br>
Modified: lld/trunk/lib/Driver/Driver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Driver.cpp?rev=255819&r1=255818&r2=255819&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Driver.cpp?rev=255819&r1=255818&r2=255819&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/Driver/Driver.cpp (original)<br>
+++ lld/trunk/lib/Driver/Driver.cpp Wed Dec 16 14:53:27 2015<br>
@@ -64,8 +64,7 @@ FileVector loadFile(LinkingContext &ctx,<br>
   return files;<br>
 }<br>
<br>
-/// This is where the link is actually performed.<br>
-bool Driver::link(LinkingContext &ctx, raw_ostream &diagnostics) {<br>
+void Driver::parseLLVMOptions(const LinkingContext &ctx) {<br>
   // Honor -mllvm<br>
   if (!ctx.llvmOptions().empty()) {<br>
     unsigned numArgs = ctx.llvmOptions().size();<br>
@@ -76,6 +75,10 @@ bool Driver::link(LinkingContext &ctx, r<br>
     args[numArgs + 1] = nullptr;<br>
     llvm::cl::ParseCommandLineOptions(numArgs + 1, args);<br>
   }<br>
+}<br>
+<br>
+/// This is where the link is actually performed.<br>
+bool Driver::link(LinkingContext &ctx, raw_ostream &diagnostics) {<br>
   if (ctx.getNodes().empty())<br>
     return false;<br>
<br>
<br>
Modified: lld/trunk/lib/Driver/GnuLdDriver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=255819&r1=255818&r2=255819&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=255819&r1=255818&r2=255819&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/Driver/GnuLdDriver.cpp (original)<br>
+++ lld/trunk/lib/Driver/GnuLdDriver.cpp Wed Dec 16 14:53:27 2015<br>
@@ -637,6 +637,10 @@ bool GnuLdDriver::parse(llvm::ArrayRef<c<br>
   if (ctx->allowLinkWithDynamicLibraries())<br>
     ctx->registry().addSupportELFDynamicSharedObjects(*ctx);<br>
<br>
+  // Parse the LLVM options before we process files in case the file handling<br>
+  // makes use of things like DEBUG().<br>
+  parseLLVMOptions(*ctx);<br>
+<br>
   std::stack<int> groupStack;<br>
   int numfiles = 0;<br>
   bool asNeeded = false;<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>