@@ -5016,28 +5016,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
5016
5016
if (!Args.hasFlag(options::OPT_fimplicit_modules,
5017
5017
options::OPT_fno_implicit_modules)) {
5018
5018
CmdArgs.push_back("-fno-implicit-modules");
5019
- }
5020
-
5021
- // -fmodule-name specifies the module that is currently being built (or
5022
- // used for header checking by -fmodule-maps).
5023
- Args.AddLastArg(CmdArgs, options::OPT_fmodule_name_EQ);
5024
-
5025
- // -fmodule-map-file can be used to specify files containing module
5026
- // definitions.
5027
- Args.AddAllArgs(CmdArgs, options::OPT_fmodule_map_file);
5028
-
5029
- // -fmodule-file can be used to specify files containing precompiled modules.
5030
- if (HaveModules)
5031
- Args.AddAllArgs(CmdArgs, options::OPT_fmodule_file);
5032
- else
5033
- Args.ClaimAllArgs(options::OPT_fmodule_file);
5034
-
5035
- // -fmodule-cache-path specifies where our implicitly-built module files
5036
- // should be written.
5037
- SmallString<128> Path;
5038
- if (Arg *A = Args.getLastArg(options::OPT_fmodules_cache_path))
5039
- Path = A->getValue();
5040
- if (HaveModules) {
5019
+ } else if (HaveModules) {
5020
+ // -fmodule-cache-path specifies where our implicitly-built module files
5021
+ // should be written.
5022
+ SmallString<128> Path;
5023
+ if (Arg *A = Args.getLastArg(options::OPT_fmodules_cache_path))
5024
+ Path = A->getValue();
5041
5025
if (C.isForDiagnostics()) {
5042
5026
// When generating crash reports, we want to emit the modules along with
5043
5027
// the reproduction sources, so we ignore any provided module path.
@@ -5056,6 +5040,20 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
5056
5040
CmdArgs.push_back(Args.MakeArgString(Path));
5057
5041
}
5058
5042
5043
+ // -fmodule-name specifies the module that is currently being built (or
5044
+ // used for header checking by -fmodule-maps).
5045
+ Args.AddLastArg(CmdArgs, options::OPT_fmodule_name_EQ);
5046
+
5047
+ // -fmodule-map-file can be used to specify files containing module
5048
+ // definitions.
5049
+ Args.AddAllArgs(CmdArgs, options::OPT_fmodule_map_file);
5050
+
5051
+ // -fmodule-file can be used to specify files containing precompiled modules.
5052
+ if (HaveModules)
5053
+ Args.AddAllArgs(CmdArgs, options::OPT_fmodule_file);
5054
+ else
5055
+ Args.ClaimAllArgs(options::OPT_fmodule_file);
5056
+
5059
5057
// When building modules and generating crashdumps, we need to dump a module
5060
5058
// dependency VFS alongside the output.
5061
5059
if (HaveModules && C.isForDiagnostics()) {
0 commit comments