Index: include/clang/Driver/Options.td =================================================================== --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -770,6 +770,8 @@ Flags<[DriverOption]>; def fimplicit_modules : Flag <["-"], "fimplicit-modules">, Group, Flags<[DriverOption]>; +def fno_module_file_deps : Flag <["-"], "fno-module-file-deps">, Group, + Flags<[DriverOption]>; def fno_ms_extensions : Flag<["-"], "fno-ms-extensions">, Group; def fno_ms_compatibility : Flag<["-"], "fno-ms-compatibility">, Group; def fno_delayed_template_parsing : Flag<["-"], "fno-delayed-template-parsing">, Group; Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -325,7 +325,8 @@ A->getOption().matches(options::OPT_MD)) CmdArgs.push_back("-sys-header-deps"); - if (isa(JA)) + if (isa(JA) && + !Args.hasArg(options::OPT_fno_module_file_deps)) CmdArgs.push_back("-module-file-deps"); } Index: test/Driver/pch-deps.c =================================================================== --- test/Driver/pch-deps.c +++ test/Driver/pch-deps.c @@ -8,3 +8,8 @@ // RUN: FileCheck %s -check-prefix=CHECK-NOPCH -input-file=%t // CHECK-NOPCH: -dependency-file // CHECK-NOPCH-NOT: -module-file-deps + +// RUN: %clang -x c-header %s -o %t.pch -MMD -MT dependencies -MF %t.d -fno-module-file-deps -### 2> %t +// RUN: FileCheck %s -check-prefix=CHECK-EXPLICIT-NOPCH -input-file=%t +// CHECK-EXPLICIT-NOPCH: -dependency-file +// CHECK-EXPLICIT-NOPCH-NOT: -module-file-deps