]> granicus.if.org Git - clang/commitdiff
clang-cl: Forward /Gy or /Gy- when falling back to cl.exe
authorHans Wennborg <hans@hanshq.net>
Tue, 25 Mar 2014 14:48:54 +0000 (14:48 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 25 Mar 2014 14:48:54 +0000 (14:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204723 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/cl-fallback.c

index 2307713db7cec550359438d88ae7d89b4adcbc4b..49d73f678fc18d21f6b639c4c94519d0efb533e9 100644 (file)
@@ -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))
index 62a71e9835ddfabd1ea8466aecb63b073e1650a6..d90e5fa496461f2403076274231382b0ee0ca9e9 100644 (file)
@@ -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"