[lld] r329060 - [ELF] - Simplify createFiles. NFCI.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 3 10:18:03 PDT 2018


On second thought, I don't actually like this change... Sorry about not
saying that in review, but this is too clever. Do you mind if I ask you to
revert?

On Tue, Apr 3, 2018 at 5:09 AM George Rimar via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: grimar
> Date: Tue Apr  3 05:06:29 2018
> New Revision: 329060
>
> URL: http://llvm.org/viewvc/llvm-project?rev=329060&view=rev
> Log:
> [ELF] - Simplify createFiles. NFCI.
>
> Groups paired options together.
>
> Differential revision: https://reviews.llvm.org/D45090
>
> Modified:
>     lld/trunk/ELF/Driver.cpp
>
> Modified: lld/trunk/ELF/Driver.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=329060&r1=329059&r2=329060&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/Driver.cpp (original)
> +++ lld/trunk/ELF/Driver.cpp Tue Apr  3 05:06:29 2018
> @@ -879,7 +879,8 @@ static bool getBinaryOption(StringRef S)
>
>  void LinkerDriver::createFiles(opt::InputArgList &Args) {
>    for (auto *Arg : Args) {
> -    switch (Arg->getOption().getUnaliasedOption().getID()) {
> +    unsigned ID = Arg->getOption().getUnaliasedOption().getID();
> +    switch (ID) {
>      case OPT_library:
>        addLibrary(Arg->getValue());
>        break;
> @@ -902,25 +903,19 @@ void LinkerDriver::createFiles(opt::Inpu
>        error(Twine("cannot find linker script ") + Arg->getValue());
>        break;
>      case OPT_as_needed:
> -      Config->AsNeeded = true;
> +    case OPT_no_as_needed:
> +      Config->AsNeeded = (ID == OPT_as_needed);
>        break;
>      case OPT_format:
>        InBinary = getBinaryOption(Arg->getValue());
>        break;
> -    case OPT_no_as_needed:
> -      Config->AsNeeded = false;
> -      break;
>      case OPT_Bstatic:
> -      Config->Static = true;
> -      break;
>      case OPT_Bdynamic:
> -      Config->Static = false;
> +      Config->Static = (ID == OPT_Bstatic);
>        break;
>      case OPT_whole_archive:
> -      InWholeArchive = true;
> -      break;
>      case OPT_no_whole_archive:
> -      InWholeArchive = false;
> +      InWholeArchive = (ID == OPT_whole_archive);
>        break;
>      case OPT_just_symbols:
>        if (Optional<MemoryBufferRef> MB = readFile(Arg->getValue())) {
> @@ -929,10 +924,8 @@ void LinkerDriver::createFiles(opt::Inpu
>        }
>        break;
>      case OPT_start_lib:
> -      InLib = true;
> -      break;
>      case OPT_end_lib:
> -      InLib = false;
> +      InLib = (ID == OPT_start_lib);
>        break;
>      }
>    }
>
>
> _______________________________________________
> 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/20180403/938d2a37/attachment.html>


More information about the llvm-commits mailing list