Index: cfe/trunk/include/clang/Driver/CLCompatOptions.td =================================================================== --- cfe/trunk/include/clang/Driver/CLCompatOptions.td +++ cfe/trunk/include/clang/Driver/CLCompatOptions.td @@ -154,6 +154,9 @@ def _SLASH_Fe : CLJoined<"Fe">, HelpText<"Set output executable file or directory (ends in / or \\)">, MetaVarName<"">; +def _SLASH_Fi : CLCompileJoined<"Fi">, + HelpText<"Set preprocess output file name">, + MetaVarName<"">; def _SLASH_Fo : CLCompileJoined<"Fo">, HelpText<"Set output object file, or directory (ends in / or \\)">, MetaVarName<"">; @@ -212,7 +215,6 @@ def _SLASH_FC : CLFlag<"FC">; def _SLASH_F : CLFlag<"F">; def _SLASH_Fd : CLJoined<"Fd">; -def _SLASH_Fi : CLJoined<"Fi">; def _SLASH_Fm : CLJoined<"Fm">; def _SLASH_fp : CLJoined<"fp">; def _SLASH_Fp : CLJoined<"Fp">; Index: cfe/trunk/lib/Driver/Driver.cpp =================================================================== --- cfe/trunk/lib/Driver/Driver.cpp +++ cfe/trunk/lib/Driver/Driver.cpp @@ -1615,7 +1615,10 @@ if (C.getArgs().hasArg(options::OPT__SLASH_P)) { assert(AtTopLevel && isa(JA)); StringRef BaseName = llvm::sys::path::filename(BaseInput); - return C.addResultFile(MakeCLOutputFilename(C.getArgs(), "", BaseName, + StringRef NameArg; + if (Arg *A = C.getArgs().getLastArg(options::OPT__SLASH_Fi)) + NameArg = A->getValue(); + return C.addResultFile(MakeCLOutputFilename(C.getArgs(), NameArg, BaseName, types::TY_PP_C), &JA); } Index: cfe/trunk/test/Driver/cl-outputs.c =================================================================== --- cfe/trunk/test/Driver/cl-outputs.c +++ cfe/trunk/test/Driver/cl-outputs.c @@ -109,3 +109,11 @@ // RUN: %clang_cl /P -### -- %s 2>&1 | FileCheck -check-prefix=P %s // P: "-E" // P: "-o" "cl-outputs.i" + +// RUN: %clang_cl /P /Fifoo -### -- %s 2>&1 | FileCheck -check-prefix=Fi1 %s +// Fi1: "-E" +// Fi1: "-o" "foo.i" + +// RUN: %clang_cl /P /Fifoo.x -### -- %s 2>&1 | FileCheck -check-prefix=Fi2 %s +// Fi2: "-E" +// Fi2: "-o" "foo.x"