]> granicus.if.org Git - clang/commitdiff
Add support for the /EP argument to clang-cl
authorHans Wennborg <hans@hanshq.net>
Fri, 13 Jun 2014 20:59:54 +0000 (20:59 +0000)
committerHans Wennborg <hans@hanshq.net>
Fri, 13 Jun 2014 20:59:54 +0000 (20:59 +0000)
This maps the /EP argument to both -E and -P.

Patch by Ehsan Akhgari!

Differential Reviion: http://reviews.llvm.org/D4133

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210935 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Driver/CLCompatOptions.td
lib/Driver/Driver.cpp
lib/Driver/Tools.cpp
test/Driver/cl-options.c

index a4881e24ff494c9f9724f7857ec661d05bc3dc41..e80a44b8f27a89e602ca0eef5162ea8a361b0215 100644 (file)
@@ -140,6 +140,8 @@ def _SLASH_Zs : CLFlag<"Zs">, HelpText<"Syntax-check only">,
 
 def _SLASH_M_Group : OptionGroup<"</M group>">, Group<cl_compile_Group>;
 
+def _SLASH_EP : CLFlag<"EP">,
+  HelpText<"Disable linemarker output and preprocess to stdout">;
 def _SLASH_FA : CLFlag<"FA">,
   HelpText<"Output assembly code file during compilation">;
 def _SLASH_Fa : CLJoined<"Fa">,
@@ -205,7 +207,6 @@ def _SLASH_clr : CLJoined<"clr">;
 def _SLASH_d2Zi_PLUS : CLFlag<"d2Zi+">;
 def _SLASH_doc : CLJoined<"doc">;
 def _SLASH_EH : CLJoined<"EH">;
-def _SLASH_EP : CLFlag<"EP">;
 def _SLASH_FA_joined : CLJoined<"FA">;
 def _SLASH_favor : CLJoined<"favor">;
 def _SLASH_FC : CLFlag<"FC">;
index 67e01224356f315395735b84a61abc2c3cb543a1..1a9de3aebf7d394af427a3d0b5d650c4df72d180 100644 (file)
@@ -152,9 +152,10 @@ const {
   Arg *PhaseArg = nullptr;
   phases::ID FinalPhase;
 
-  // -{E,M,MM} and /P only run the preprocessor.
+  // -{E,EP,P,M,MM} only run the preprocessor.
   if (CCCIsCPP() ||
       (PhaseArg = DAL.getLastArg(options::OPT_E)) ||
+      (PhaseArg = DAL.getLastArg(options::OPT__SLASH_EP)) ||
       (PhaseArg = DAL.getLastArg(options::OPT_M, options::OPT_MM)) ||
       (PhaseArg = DAL.getLastArg(options::OPT__SLASH_P))) {
     FinalPhase = phases::Preprocess;
index 0df398b338d4e192e388292924935eb224c40c8d..e49267acd1ef819b6256d85a275cf415f8cf74dd 100644 (file)
@@ -4363,6 +4363,12 @@ void Clang::AddClangCLArgs(const ArgList &Args, ArgStringList &CmdArgs) const {
   if (!Args.hasArg(options::OPT_frtti, options::OPT_fno_rtti))
     CmdArgs.push_back("-fno-rtti");
 
+  // /EP should expand to -E -P.
+  if (Args.hasArg(options::OPT__SLASH_EP)) {
+    CmdArgs.push_back("-E");
+    CmdArgs.push_back("-P");
+  }
+
   const Driver &D = getToolChain().getDriver();
   Arg *MostGeneralArg = Args.getLastArg(options::OPT__SLASH_vmg);
   Arg *BestCaseArg = Args.getLastArg(options::OPT__SLASH_vmb);
index eaf7e172d693573e54fbc0a62c1e09ec54ab91ce..38cbb347c6be0938a394075d565656e57f84ad4e 100644 (file)
 // E: "-E"
 // E: "-o" "-"
 
+// RUN: %clang_cl /EP -### -- %s 2>&1 | FileCheck -check-prefix=EP %s
+// EP: "-E"
+// EP: "-P"
+// EP: "-o" "-"
+
 // RTTI is on by default; just check that we don't error.
 // RUN: %clang_cl /Zs /GR -- %s 2>&1
 
 // RUN:     /docname \
 // RUN:     /d2Zi+ \
 // RUN:     /EHsc \
-// RUN:     /EP \
 // RUN:     /F \
 // RUN:     /FA \
 // RUN:     /FAc \