[PATCH] Driver: Replace switch cases with ifs.

Sean Silva chisophugis at gmail.com
Mon Feb 9 16:30:08 PST 2015


This probably makes sense for consistency with clang, but FYI with current
libOption each of the "getLastArg" is linear in the command line length, so
the previous switch version was actually much more efficient.

This might be more problematic for LLD than for clang since linker command
lines can sometimes end up being much longer than compiler command lines.

 The right fix of course is for libOption to cache or otherwise avoid
O(cmdline length) work per getLastArg.

-- Sean Silva

On Fri, Feb 6, 2015 at 4:42 PM, Rui Ueyama <ruiu at google.com> wrote:

> Hi shankarke,
>
> We used to do like this instead of putting all command line processing
> code within one gigantic switch statement. It is converted to a switch
> in r188958, which introduced InputGraph.
>
> Making bunch of ifs to one switch statement with bunch of cases weren't
> needed for InputGraph, so I don't know why that change was made in the
> first place.
>
> In this patch I roll that change back. Now all "break"s are removed,
> and the nesting is one level shallow.
>
> http://reviews.llvm.org/D7478
>
> Files:
>   lib/Driver/WinLinkDriver.cpp
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150209/1034f274/attachment.html>


More information about the llvm-commits mailing list