From: Hans Wennborg Date: Tue, 25 Mar 2014 14:48:54 +0000 (+0000) Subject: clang-cl: Forward /Gy or /Gy- when falling back to cl.exe X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d13c37832fb3792e1a05352184cb7b73e9fc8a93;p=clang clang-cl: Forward /Gy or /Gy- when falling back to cl.exe git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204723 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 2307713db7..49d73f678f 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -7364,6 +7364,11 @@ Command *visualstudio::Compile::GetCommand(Compilation &C, const JobAction &JA, if (Arg *A = Args.getLastArg(options::OPT_frtti, options::OPT_fno_rtti)) CmdArgs.push_back(A->getOption().getID() == options::OPT_frtti ? "/GR" : "/GR-"); + if (Arg *A = Args.getLastArg(options::OPT_ffunction_sections, + options::OPT_fno_function_sections)) + CmdArgs.push_back(A->getOption().getID() == options::OPT_ffunction_sections + ? "/Gy" + : "/Gy-"); if (Args.hasArg(options::OPT_fsyntax_only)) CmdArgs.push_back("/Zs"); if (Args.hasArg(options::OPT_g_Flag, options::OPT_gline_tables_only)) diff --git a/test/Driver/cl-fallback.c b/test/Driver/cl-fallback.c index 62a71e9835..d90e5fa496 100644 --- a/test/Driver/cl-fallback.c +++ b/test/Driver/cl-fallback.c @@ -4,8 +4,9 @@ // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. -// RUN: %clang_cl /fallback /Dfoo=bar /Ubaz /Ifoo /O0 /Ox /GR /GR- /LD /LDd \ -// RUN: /MD /MDd /MTd /MT /FImyheader.h /Zi -### -- %s 2>&1 | FileCheck %s +// RUN: %clang_cl /fallback /Dfoo=bar /Ubaz /Ifoo /O0 /Ox /GR /GR- /Gy /Gy- \ +// RUN: /LD /LDd /MD /MDd /MTd /MT /FImyheader.h /Zi -### -- %s 2>&1 \ +// RUN: | FileCheck %s // CHECK: "-fdiagnostics-format" "msvc-fallback" // CHECK: || // CHECK: cl.exe @@ -17,6 +18,7 @@ // CHECK: "-I" "foo" // CHECK: "/Ox" // CHECK: "/GR-" +// CHECK: "/Gy-" // CHECK: "/Z7" // CHECK: "/FImyheader.h" // CHECK: "/LD"