Index: cfe/trunk/lib/Driver/Tools.cpp =================================================================== --- cfe/trunk/lib/Driver/Tools.cpp +++ cfe/trunk/lib/Driver/Tools.cpp @@ -9482,26 +9482,21 @@ assert(II.getType() == types::TY_C || II.getType() == types::TY_CXX); assert(Output.getType() == types::TY_PP_Asm); // Require preprocessed asm. - // Append all -I, -iquote, -isystem paths, and defines/undefines. - // These are spelled the same way in clang and moviCompile. - Args.AddAllArgs(CmdArgs, - {options::OPT_clang_i_Group, options::OPT_D, options::OPT_U}); - CmdArgs.push_back("-DMYRIAD2"); 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"); - + // Append all -I, -iquote, -isystem paths, defines/undefines, + // 'f' flags, optimize flags, and warning options. + // These are spelled the same way in clang and moviCompile. + Args.AddAllArgs(CmdArgs, + {options::OPT_I_Group, options::OPT_clang_i_Group, + options::OPT_D, options::OPT_U, + options::OPT_f_Group, + options::OPT_f_clang_Group, + options::OPT_g_Group, + 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: cfe/trunk/test/Driver/shave-toolchain.c =================================================================== --- cfe/trunk/test/Driver/shave-toolchain.c +++ cfe/trunk/test/Driver/shave-toolchain.c @@ -10,7 +10,7 @@ // RUN: %clang -target shave -c -### %s -Icommon 2>&1 \ // RUN: | FileCheck %s -check-prefix=movicompile -// movicompile: moviCompile" "-DMYRIAD2" +// movicompile: moviCompile" "-DMYRIAD2" "-mcpu=myriad2" "-S" "-I" "common" // movicompile: moviAsm" "-no6thSlotCompression" "-cv:myriad2" "-noSPrefixing" "-a" "-i:common" "-elf" // RUN: %clang -target shave -c -### %s -DEFINE_ME -UNDEFINE_ME 2>&1 \ @@ -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 -g -fno-inline-functions \ +// RUN: -fno-inline-functions-called-once -Os -Wall \ +// RUN: -ffunction-sections 2>&1 | FileCheck %s -check-prefix=F_G_O_W_OPTIONS +// F_G_O_W_OPTIONS: "-g" "-fno-inline-functions" "-fno-inline-functions-called-once" +// F_G_O_W_OPTIONS: "-Os" "-Wall" "-ffunction-sections"