r211081 - Add support for the /Fi argument to clang-cl (PR20036)
Hans Wennborg
hans at hanshq.net
Mon Jun 16 17:19:12 PDT 2014
Author: hans
Date: Mon Jun 16 19:19:12 2014
New Revision: 211081
URL: http://llvm.org/viewvc/llvm-project?rev=211081&view=rev
Log:
Add support for the /Fi argument to clang-cl (PR20036)
Patch by Ehsan Akhgari!
Differential Revision: http://reviews.llvm.org/D4143
Modified:
cfe/trunk/include/clang/Driver/CLCompatOptions.td
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/cl-outputs.c
Modified: cfe/trunk/include/clang/Driver/CLCompatOptions.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CLCompatOptions.td?rev=211081&r1=211080&r2=211081&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CLCompatOptions.td (original)
+++ cfe/trunk/include/clang/Driver/CLCompatOptions.td Mon Jun 16 19:19:12 2014
@@ -154,6 +154,9 @@ def _SLASH_FI : CLJoinedOrSeparate<"FI">
def _SLASH_Fe : CLJoined<"Fe">,
HelpText<"Set output executable file or directory (ends in / or \\)">,
MetaVarName<"<file or directory>">;
+def _SLASH_Fi : CLCompileJoined<"Fi">,
+ HelpText<"Set preprocess output file name">,
+ MetaVarName<"<file>">;
def _SLASH_Fo : CLCompileJoined<"Fo">,
HelpText<"Set output object file, or directory (ends in / or \\)">,
MetaVarName<"<file or directory>">;
@@ -212,7 +215,6 @@ def _SLASH_favor : CLJoined<"favor">;
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">;
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=211081&r1=211080&r2=211081&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Mon Jun 16 19:19:12 2014
@@ -1615,7 +1615,10 @@ const char *Driver::GetNamedOutputPath(C
if (C.getArgs().hasArg(options::OPT__SLASH_P)) {
assert(AtTopLevel && isa<PreprocessJobAction>(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);
}
Modified: cfe/trunk/test/Driver/cl-outputs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-outputs.c?rev=211081&r1=211080&r2=211081&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-outputs.c (original)
+++ cfe/trunk/test/Driver/cl-outputs.c Mon Jun 16 19:19:12 2014
@@ -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"
More information about the cfe-commits
mailing list