[PATCH] Fix code duplication in lib/Driver/Tools.cpp

Dmitri Gribenko gribozavr at gmail.com
Sun Feb 24 05:40:28 PST 2013


On Sun, Feb 24, 2013 at 9:25 AM, evgeny <illumsoft.org at gmail.com> wrote:
> I am interested in clang on Illumos, so I started to work on 'Find a real GCC,
> don't hard-code versions here' as written in lib/Driver/Tools.cpp
>
> I think there is a code duplication in function
> void solaris::Link::ConstructJob (the file lib/Driver/Tools.cpp)
> please see attached patch.

Hi Evgeny,

This looks like a correct refactoring without changing the
functionality.  I can certainly apply this patch, but it does not help
much (and there's a code style issue with 'case' indentation).  Before
you start hacking on the new implementation, it would help to add
tests first (I don't see any Solaris or Illumos tests for the driver).
 Please take a look at test/Driver/freebsd.c and
test/Driver/Inputs/basic_freebsd_tree/ for an example.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-commits mailing list