dougk created this revision.
dougk added a reviewer: jyknight.
dougk added a subscriber: cfe-commits.

http://reviews.llvm.org/D11581

Files:
  lib/Driver/Tools.cpp
  test/Driver/shave-toolchain.c

Index: test/Driver/shave-toolchain.c
===================================================================
--- test/Driver/shave-toolchain.c
+++ test/Driver/shave-toolchain.c
@@ -20,3 +20,9 @@
 // RUN: %clang -target shave -c -### %s -Icommon -iquote quotepath -isystem 
syspath 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=includes
 // includes: "-iquote" "quotepath" "-isystem" "syspath"
+
+// RUN: %clang -target shave -c -### %s -fno-inline-functions \
+// RUN: -fno-inline-functions-called-once -g -Os -Wall \
+// RUN: -ffunction-sections 2>&1 | FileCheck %s -check-prefix=F_G_O_W_OPTIONS
+// F_G_O_W_OPTIONS: "-fno-inline-functions" "-fno-inline-functions-called-once"
+// F_G_O_W_OPTIONS: "-g" "-ffunction-sections" "-Os" "-Wall"
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -9479,17 +9479,13 @@
   CmdArgs.push_back("-mcpu=myriad2");
   CmdArgs.push_back("-S");
 
-  // Any -O option passes through without translation. What about -Ofast ?
-  if (Arg *A = Args.getLastArg(options::OPT_O_Group))
-    A->render(Args, CmdArgs);
-
-  if (Args.hasFlag(options::OPT_ffunction_sections,
-                   options::OPT_fno_function_sections)) {
-    CmdArgs.push_back("-ffunction-sections");
-  }
-  if (Args.hasArg(options::OPT_fno_inline_functions))
-    CmdArgs.push_back("-fno-inline-functions");
-
+  Args.AddAllArgs(CmdArgs,
+                  options::OPT_f_Group,
+                  options::OPT_f_clang_Group,
+                  options::OPT_g_Group);
+  Args.AddAllArgs(CmdArgs,
+                  options::OPT_O_Group,
+                  options::OPT_W_Group);
   CmdArgs.push_back("-fno-exceptions"); // Always do this even if unspecified.
 
   CmdArgs.push_back(II.getFilename());


Index: test/Driver/shave-toolchain.c
===================================================================
--- test/Driver/shave-toolchain.c
+++ test/Driver/shave-toolchain.c
@@ -20,3 +20,9 @@
 // RUN: %clang -target shave -c -### %s -Icommon -iquote quotepath -isystem syspath 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=includes
 // includes: "-iquote" "quotepath" "-isystem" "syspath"
+
+// RUN: %clang -target shave -c -### %s -fno-inline-functions \
+// RUN: -fno-inline-functions-called-once -g -Os -Wall \
+// RUN: -ffunction-sections 2>&1 | FileCheck %s -check-prefix=F_G_O_W_OPTIONS
+// F_G_O_W_OPTIONS: "-fno-inline-functions" "-fno-inline-functions-called-once"
+// F_G_O_W_OPTIONS: "-g" "-ffunction-sections" "-Os" "-Wall"
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -9479,17 +9479,13 @@
   CmdArgs.push_back("-mcpu=myriad2");
   CmdArgs.push_back("-S");
 
-  // Any -O option passes through without translation. What about -Ofast ?
-  if (Arg *A = Args.getLastArg(options::OPT_O_Group))
-    A->render(Args, CmdArgs);
-
-  if (Args.hasFlag(options::OPT_ffunction_sections,
-                   options::OPT_fno_function_sections)) {
-    CmdArgs.push_back("-ffunction-sections");
-  }
-  if (Args.hasArg(options::OPT_fno_inline_functions))
-    CmdArgs.push_back("-fno-inline-functions");
-
+  Args.AddAllArgs(CmdArgs,
+                  options::OPT_f_Group,
+                  options::OPT_f_clang_Group,
+                  options::OPT_g_Group);
+  Args.AddAllArgs(CmdArgs,
+                  options::OPT_O_Group,
+                  options::OPT_W_Group);
   CmdArgs.push_back("-fno-exceptions"); // Always do this even if unspecified.
 
   CmdArgs.push_back(II.getFilename());
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to