[PATCH] [Driver] Don't forward source file input args to gcc

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Jun 18 12:45:38 PDT 2013


LGTM

On 18 June 2013 10:49, Reid Kleckner <rnk at google.com> wrote:
> gcc's inputs are already added by the InputInfoList passed to
> Action::ConstructJob.
>
> Fixes a regression from r183989.  This was manifesting when targetting
> mingw as an extra input argument to gcc when assembling.  It presumably
> affects other situations where clang calls gcc.
>
> Prior to r183989, forwardToGCC() was returning false because the INPUT
> option defined in OptParser.td had the DriverOption flag set on it.
> LLVM's Option library does not set this flag for INPUT.
>
> http://llvm-reviews.chandlerc.com/D999
>
> Files:
>   lib/Driver/Tools.cpp
>   test/Driver/no-integrated-as-win.c
>
> Index: lib/Driver/Tools.cpp
> ===================================================================
> --- lib/Driver/Tools.cpp
> +++ lib/Driver/Tools.cpp
> @@ -224,7 +224,10 @@
>  }
>
>  static bool forwardToGCC(const Option &O) {
> -  return !O.hasFlag(options::NoForward) &&
> +  // Don't forward inputs from the original command line.  They are added from
> +  // InputInfoList.
> +  return !O.getKind() == Option::InputClass &&
> +         !O.hasFlag(options::NoForward) &&
>           !O.hasFlag(options::DriverOption) &&
>           !O.hasFlag(options::LinkerInput);
>  }
> Index: test/Driver/no-integrated-as-win.c
> ===================================================================
> --- test/Driver/no-integrated-as-win.c
> +++ test/Driver/no-integrated-as-win.c
> @@ -1,3 +1,11 @@
>  // RUN: %clang -target x86_64-pc-win32 -### -no-integrated-as %s -c 2>&1 | FileCheck %s
> -
>  // CHECK: there is no external assembler we can use on windows
> +
> +// But there is for mingw.  The source file should only be mentioned once for
> +// the compile step.
> +// RUN: %clang -target i686-pc-mingw32 -### -no-integrated-as %s -c 2>&1 | FileCheck -check-prefix=MINGW %s
> +// MINGW: "-cc1"
> +// MINGW: "-main-file-name" "no-integrated-as-win.c"
> +// MINGW: "-x" "c" "{{.*}}no-integrated-as-win.c"
> +// The assembler goes here, but its name depends on PATH.
> +// MINGW-NOT: no-integrated-as-win.c
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>



More information about the cfe-commits mailing list