]> granicus.if.org Git - clang/commitdiff
[Driver] Fix -Wp,-MMD pr13959
authorMichael J. Spencer <bigcheesegs@gmail.com>
Wed, 7 Nov 2012 23:37:14 +0000 (23:37 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Wed, 7 Nov 2012 23:37:14 +0000 (23:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167559 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp
test/Driver/Wp-args.c

index d4b1bae6dd21f975f347d05b0d6a073883d02154..4fc6db980c083171d5f792e804cb366bb7a7ee4a 100644 (file)
@@ -185,7 +185,6 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const {
     // some build systems. We don't try to be complete here because we don't
     // care to encourage this usage model.
     if (A->getOption().matches(options::OPT_Wp_COMMA) &&
-        A->getNumValues() == 2 &&
         (A->getValue(0) == StringRef("-MD") ||
          A->getValue(0) == StringRef("-MMD"))) {
       // Rewrite to -MD/-MMD along with -MF.
@@ -193,8 +192,9 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const {
         DAL->AddFlagArg(A, Opts->getOption(options::OPT_MD));
       else
         DAL->AddFlagArg(A, Opts->getOption(options::OPT_MMD));
-      DAL->AddSeparateArg(A, Opts->getOption(options::OPT_MF),
-                          A->getValue(1));
+      if (A->getNumValues() == 2)
+        DAL->AddSeparateArg(A, Opts->getOption(options::OPT_MF),
+                            A->getValue(1));
       continue;
     }
 
index 0ab85b4c9c76ec37bb69a36559a2813a5a7ef225..1d1af24804a1af4446ed43a1605fd587da9a9a2b 100644 (file)
 // CHECK: "-MT"
 //
 // PR4062
+
+// RUN: %clang --target i386-pc-linux-gnu -### \
+// RUN:   -Wp,-MMD -fsyntax-only %s 2> %t
+// RUN: FileCheck -check-prefix MMD < %t %s
+
+// MMD: "-cc1"
+// MMD-NOT: -MMD
+// MMD: "-dependency-file" "Wp-args.d"