[lld] r255819 - Move parsing of LLVM options to parse() method.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 13:30:14 PST 2015


Thanks!

On Wed, Dec 16, 2015 at 1:28 PM, Pete Cooper <peter_cooper at apple.com> wrote:

> Should be fixed by r255822.
>
> Thanks,
> Pete
>
> On Dec 16, 2015, at 1:10 PM, Rui Ueyama <ruiu at google.com> wrote:
>
> On Wed, Dec 16, 2015 at 1:08 PM, Pete Cooper <peter_cooper at apple.com>
> wrote:
>
>> Sorry, yeah will look right now.
>>
>> I did ‘check-lld’.  I forgot that doesn’t run the unit tests.
>>
>
> I believe it runs the unit tests as I also just did 'check-lld'.
>
>
>>
>> Pete
>>
>> On Dec 16, 2015, at 1:06 PM, Rui Ueyama <ruiu at google.com> wrote:
>>
>> It started failing with the following error. Can you take a look?
>>
>> -- 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'
>>
>>
>> On Wed, Dec 16, 2015 at 12:53 PM, Pete Cooper via llvm-commits <
>> llvm-commits at lists.llvm.org> wrote:
>>
>>> Author: pete
>>> Date: Wed Dec 16 14:53:27 2015
>>> New Revision: 255819
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=255819&view=rev
>>> Log:
>>> Move parsing of LLVM options to parse() method.
>>>
>>> We used to parse the LLVM options in Driver::link.  However, that is
>>> after parse() where we load files.  By moving the LLVM option handling
>>> earlier, we can add DEBUG() to code such as
>>> MachONormalizedFileToAtoms.cpp
>>> and have it enabled correctly by '-mllvm --debug'.
>>>
>>> Modified:
>>>     lld/trunk/include/lld/Driver/Driver.h
>>>     lld/trunk/lib/Driver/CoreDriver.cpp
>>>     lld/trunk/lib/Driver/DarwinLdDriver.cpp
>>>     lld/trunk/lib/Driver/Driver.cpp
>>>     lld/trunk/lib/Driver/GnuLdDriver.cpp
>>>
>>> Modified: lld/trunk/include/lld/Driver/Driver.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/Driver.h?rev=255819&r1=255818&r2=255819&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/include/lld/Driver/Driver.h (original)
>>> +++ lld/trunk/include/lld/Driver/Driver.h Wed Dec 16 14:53:27 2015
>>> @@ -46,6 +46,9 @@ protected:
>>>    static bool link(LinkingContext &context,
>>>                     raw_ostream &diag = llvm::errs());
>>>
>>> +  /// Parses the LLVM options from the context.
>>> +  static void parseLLVMOptions(const LinkingContext &context);
>>> +
>>>  private:
>>>    Driver() = delete;
>>>  };
>>>
>>> Modified: lld/trunk/lib/Driver/CoreDriver.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/CoreDriver.cpp?rev=255819&r1=255818&r2=255819&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/lib/Driver/CoreDriver.cpp (original)
>>> +++ lld/trunk/lib/Driver/CoreDriver.cpp Wed Dec 16 14:53:27 2015
>>> @@ -159,6 +159,8 @@ bool CoreDriver::parse(llvm::ArrayRef<co
>>>      }
>>>    }
>>>
>>> +  parseLLVMOptions(ctx);
>>> +
>>>    if (ctx.getNodes().empty()) {
>>>      diagnostics << "No input files\n";
>>>      return false;
>>>
>>> Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=255819&r1=255818&r2=255819&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)
>>> +++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Wed Dec 16 14:53:27 2015
>>> @@ -822,6 +822,10 @@ bool DarwinLdDriver::parse(llvm::ArrayRe
>>>      }
>>>    }
>>>
>>> +  // Parse the LLVM options before we process files in case the file
>>> handling
>>> +  // makes use of things like DEBUG().
>>> +  parseLLVMOptions(ctx);
>>> +
>>>    // Handle input files and sectcreate.
>>>    for (auto &arg : parsedArgs) {
>>>      bool upward;
>>>
>>> Modified: lld/trunk/lib/Driver/Driver.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Driver.cpp?rev=255819&r1=255818&r2=255819&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/lib/Driver/Driver.cpp (original)
>>> +++ lld/trunk/lib/Driver/Driver.cpp Wed Dec 16 14:53:27 2015
>>> @@ -64,8 +64,7 @@ FileVector loadFile(LinkingContext &ctx,
>>>    return files;
>>>  }
>>>
>>> -/// This is where the link is actually performed.
>>> -bool Driver::link(LinkingContext &ctx, raw_ostream &diagnostics) {
>>> +void Driver::parseLLVMOptions(const LinkingContext &ctx) {
>>>    // Honor -mllvm
>>>    if (!ctx.llvmOptions().empty()) {
>>>      unsigned numArgs = ctx.llvmOptions().size();
>>> @@ -76,6 +75,10 @@ bool Driver::link(LinkingContext &ctx, r
>>>      args[numArgs + 1] = nullptr;
>>>      llvm::cl::ParseCommandLineOptions(numArgs + 1, args);
>>>    }
>>> +}
>>> +
>>> +/// This is where the link is actually performed.
>>> +bool Driver::link(LinkingContext &ctx, raw_ostream &diagnostics) {
>>>    if (ctx.getNodes().empty())
>>>      return false;
>>>
>>>
>>> Modified: lld/trunk/lib/Driver/GnuLdDriver.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=255819&r1=255818&r2=255819&view=diff
>>>
>>> ==============================================================================
>>> --- lld/trunk/lib/Driver/GnuLdDriver.cpp (original)
>>> +++ lld/trunk/lib/Driver/GnuLdDriver.cpp Wed Dec 16 14:53:27 2015
>>> @@ -637,6 +637,10 @@ bool GnuLdDriver::parse(llvm::ArrayRef<c
>>>    if (ctx->allowLinkWithDynamicLibraries())
>>>      ctx->registry().addSupportELFDynamicSharedObjects(*ctx);
>>>
>>> +  // Parse the LLVM options before we process files in case the file
>>> handling
>>> +  // makes use of things like DEBUG().
>>> +  parseLLVMOptions(*ctx);
>>> +
>>>    std::stack<int> groupStack;
>>>    int numfiles = 0;
>>>    bool asNeeded = false;
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151216/32229b0a/attachment.html>


More information about the llvm-commits mailing list