summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-01-18 15:19:58 +0000
committerDouglas Gregor <dgregor@apple.com>2012-01-18 15:19:58 +0000
commit226173ae937ef88f6df33581067ca0003261cb66 (patch)
tree43a003785ec287ad50a91b78911ac94fc301139d /clang/lib/Driver/Tools.cpp
parent6255c257e95348f4c03de9ed9657f57b9a68316f (diff)
downloadbcm5719-llvm-226173ae937ef88f6df33581067ca0003261cb66.tar.gz
bcm5719-llvm-226173ae937ef88f6df33581067ca0003261cb66.zip
In the driver, -fmodules enables modules for C/Objective-C but one
also needs -fcxx-modules to enable modules for C++/Objective-C++. llvm-svn: 148393
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 39868c82366..9c50ae54eec 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -2029,8 +2029,16 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-fblocks-runtime-optional");
}
- if (Args.hasFlag(options::OPT_fmodules, options::OPT_fno_modules, false))
- CmdArgs.push_back("-fmodules");
+ // -fmodules enables modules (off by default). However, for C++/Objective-C++,
+ // users must also pass -fcxx-modules. The latter flag will disappear once the
+ // modules implementation is solid for C++/Objective-C++ programs as well.
+ if (Args.hasFlag(options::OPT_fmodules, options::OPT_fno_modules, false)) {
+ bool AllowedInCXX = Args.hasFlag(options::OPT_fcxx_modules,
+ options::OPT_fno_cxx_modules,
+ false);
+ if (AllowedInCXX || !types::isCXX(InputType))
+ CmdArgs.push_back("-fmodules");
+ }
// -faccess-control is default.
if (Args.hasFlag(options::OPT_fno_access_control,
OpenPOWER on IntegriCloud