diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 9878a9dad78d4..9b7dd189c60d7 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -458,6 +458,7 @@ 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() > 0 && (A->getValue(0) == StringRef("-MD") || A->getValue(0) == StringRef("-MMD"))) { // Rewrite to -MD/-MMD along with -MF.