r247384 - [modules] Don't load files specified by -fmodule-file= when modules are
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 10 20:58:07 PDT 2015
Author: rsmith
Date: Thu Sep 10 22:58:07 2015
New Revision: 247384
URL: http://llvm.org/viewvc/llvm-project?rev=247384&view=rev
Log:
[modules] Don't load files specified by -fmodule-file= when modules are
disabled. (We still allow this via -cc1 / -Xclang, primarily for testing.)
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/modules.m
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=247384&r1=247383&r2=247384&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Sep 10 22:58:07 2015
@@ -4461,7 +4461,10 @@ void Clang::ConstructJob(Compilation &C,
Args.AddAllArgs(CmdArgs, options::OPT_fmodule_map_file);
// -fmodule-file can be used to specify files containing precompiled modules.
- Args.AddAllArgs(CmdArgs, options::OPT_fmodule_file);
+ if (HaveModules)
+ Args.AddAllArgs(CmdArgs, options::OPT_fmodule_file);
+ else
+ Args.ClaimAllArgs(options::OPT_fmodule_file);
// -fmodule-cache-path specifies where our implicitly-built module files
// should be written.
Modified: cfe/trunk/test/Driver/modules.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/modules.m?rev=247384&r1=247383&r2=247384&view=diff
==============================================================================
--- cfe/trunk/test/Driver/modules.m (original)
+++ cfe/trunk/test/Driver/modules.m Thu Sep 10 22:58:07 2015
@@ -37,3 +37,13 @@
// CHECK-MODULE-MAP-FILES: "-fmodules"
// CHECK-MODULE-MAP-FILES: "-fmodule-map-file=foo.map"
// CHECK-MODULE-MAP-FILES: "-fmodule-map-file=bar.map"
+
+// RUN: %clang -fmodules -fmodule-file=foo.pcm -fmodule-file=bar.pcm -### %s 2>&1 | FileCheck -check-prefix=CHECK-MODULE-FILES %s
+// CHECK-MODULE-FILES: "-fmodules"
+// CHECK-MODULE-FILES: "-fmodule-file=foo.pcm"
+// CHECK-MODULE-FILES: "-fmodule-file=bar.pcm"
+
+// RUN: %clang -fno-modules -fmodule-file=foo.pcm -fmodule-file=bar.pcm -### %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MODULE-FILES %s
+// CHECK-NO-MODULE-FILES-NOT: "-fmodules"
+// CHECK-NO-MODULE-FILES-NOT: "-fmodule-file=foo.pcm"
+// CHECK-NO-MODULE-FILES-NOT: "-fmodule-file=bar.pcm"
More information about the cfe-commits
mailing list