On 2012-09-15 17:20, David Blaikie wrote:
On Sat, Sep 15, 2012 at 3:02 AM, Dimitry Andric <[email protected]> wrote:
As reported in PR 13851, clang (trunk r163208) seems to ignore any -MF
option that is used in combination with -E -M or -E -MM.  For example:
...
Could you include the test cases you described in your email (& any
others you think might be relevant) as actual test cases in your
patch?

Here's a patch including a relatively simple testcase.
Index: tools/clang/lib/Driver/Tools.cpp
===================================================================
--- tools/clang/lib/Driver/Tools.cpp	(revision 164369)
+++ tools/clang/lib/Driver/Tools.cpp	(working copy)
@@ -219,11 +219,11 @@ void Clang::AddPreprocessingOptions(Compilation &C
       (A = Args.getLastArg(options::OPT_MMD))) {
     // Determine the output location.
     const char *DepFile;
-    if (Output.getType() == types::TY_Dependencies) {
-      DepFile = Output.getFilename();
-    } else if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
+    if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
       DepFile = MF->getValue(Args);
       C.addFailureResultFile(DepFile);
+    } else if (Output.getType() == types::TY_Dependencies) {
+      DepFile = Output.getFilename();
     } else if (A->getOption().matches(options::OPT_M) ||
                A->getOption().matches(options::OPT_MM)) {
       DepFile = "-";
Index: tools/clang/test/Preprocessor/pr13851.c
===================================================================
--- tools/clang/test/Preprocessor/pr13851.c	(revision 0)
+++ tools/clang/test/Preprocessor/pr13851.c	(working copy)
@@ -0,0 +1,11 @@
+// Check that -E -M -MF does not cause an "argument unused" error, by adding
+// -Werror to the clang invocation.  Also check the dependency output, if any.
+// RUN: %clang -Werror -E -M -MF %t-M.d %s
+// RUN: FileCheck --input-file=%t-M.d %s
+// CHECK: pr13851.o:
+// CHECK: pr13851.c
+
+// Check that -E -MM -MF does not cause an "argument unused" error, by adding
+// -Werror to the clang invocation.  Also check the dependency output, if any.
+// RUN: %clang -Werror -E -MM -MF %t-MM.d %s
+// RUN: FileCheck --input-file=%t-MM.d %s
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to