diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-01-18 15:19:58 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-01-18 15:19:58 +0000 |
commit | 64554ba9fc5f251108fd7d10a9c218e7bf985941 (patch) | |
tree | 62cdaa561a0e646e8dc37058f1fc5f9057e2fd51 /lib/Driver/Tools.cpp | |
parent | 7748cbc97ff9c6c3940549d30965a10b47a45ee8 (diff) |
In the driver, -fmodules enables modules for C/Objective-C but one
also needs -fcxx-modules to enable modules for C++/Objective-C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148393 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r-- | lib/Driver/Tools.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 39868c8236..9c50ae54ee 100644 --- a/lib/Driver/Tools.cpp +++ b/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, |