[cfe-commits] r73087 - in /cfe/trunk: lib/Driver/Tools.cpp test/Frontend/cpp-output.c
Daniel Dunbar
daniel at zuster.org
Mon Jun 8 14:48:20 PDT 2009
Author: ddunbar
Date: Mon Jun 8 16:48:20 2009
New Revision: 73087
URL: http://llvm.org/viewvc/llvm-project?rev=73087&view=rev
Log:
Forward -C and -CC to clang.
- <rdar://problem/6945384> Driver should pass down -C and -CC
Added:
cfe/trunk/test/Frontend/cpp-output.c
Modified:
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=73087&r1=73086&r2=73087&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Jun 8 16:48:20 2009
@@ -43,8 +43,17 @@
ArgStringList &CmdArgs,
const InputInfo &Output,
const InputInfoList &Inputs) const {
- // Handle dependency file generation.
Arg *A;
+
+ if ((A = Args.getLastArg(options::OPT_C)) ||
+ (A = Args.getLastArg(options::OPT_CC))) {
+ if (!Args.hasArg(options::OPT_E))
+ D.Diag(clang::diag::err_drv_argument_only_allowed_with)
+ << A->getAsString(Args) << "-E";
+ A->render(Args, CmdArgs);
+ }
+
+ // Handle dependency file generation.
if ((A = Args.getLastArg(options::OPT_M)) ||
(A = Args.getLastArg(options::OPT_MM)) ||
(A = Args.getLastArg(options::OPT_MD)) ||
Added: cfe/trunk/test/Frontend/cpp-output.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/cpp-output.c?rev=73087&view=auto
==============================================================================
--- cfe/trunk/test/Frontend/cpp-output.c (added)
+++ cfe/trunk/test/Frontend/cpp-output.c Mon Jun 8 16:48:20 2009
@@ -0,0 +1,15 @@
+// RUN: clang -E -o %t -C %s &&
+// RUN: grep '^int x; // comment' %t &&
+// RUN: grep '^x x' %t &&
+// RUN: clang -E -o %t -CC %s &&
+// RUN: grep '^int x; // comment' %t &&
+// RUN: grep '^x /\* comment \*/ x /\* comment \*/' %t &&
+// RUN: true
+
+int x; // comment
+
+#define A(foo, bar) foo bar
+#define B x // comment
+
+A(B, B)
+
More information about the cfe-commits
mailing list