CLANG_ENABLE_MODULES doesn't enable -fmodules in Obj-C++ files

Number:rdar://40261534 Date Originated:May 15 2018, 10:35 AM
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification:Other Bug Reproducible:Always
It looks like the CLANG_ENABLE_MODULES build setting doesn't enable the -fmodules flag in Obj-C++ files. This is problematic because it means I can't import my "ModuleName-Swift.h" bridging header in Obj-C++ as the header generated by Swift requires modules if I'm pulling in any external frameworks (which I am).

As best as I can tell, the -fmodules flag doesn't actually enable the experimental C++ modules feature anyway, that uses a separate -fcxx-modules flag, so it's unclear to me why Xcode doesn't pass -fmodules to Obj-C++ files.

Steps to Reproduce:
1. Set up an Xcode project with CLANG_ENABLE_MODULES set to Yes
2. Add an Obj-C++ file to the project
3. In the Obj-C++ file try to use an @import statement.

Expected Results:
It should compile.

Actual Results:
It complains that modules are disabled.

Xcode 9.2 (9C40b)

If there's backwards compatibility concerns you could change CLANG_ENABLE_MODULES into a trinary build setting (like some of the warning settings are), so that way people still have to opt in to it.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!