[cfe-dev] How do I try out C++ modules with clang?
Stephen Kelly
steveire at gmail.com
Sun Oct 26 11:06:57 PDT 2014
Sean Silva wrote:
> My experience has been that the easiest thing is to start out by just
> doing a "unity module" like
>
> module foo {
> header "bar"
> header "baz"
> ...
> }
>
> Just list every file in the directory (possibly recursively). Then just
> exclude any headers that are causing problems. That should get you up and
> running pretty fast.
I did this for Qt5Core and came up with
http://www.steveire.com/Qt5Core.modulemap
What is the next step?
I'd like to understand more about the modulemap language and what should be
specified there. What is the 'export *' stuff for? Qt headers define some
macros such as Q_DECL_CONSTEXPR. Do they need to be explicitly
named/exported in the modulemap file? The macro seems to work fine without
such an export.
The headers that I exclude from the include/QtCore folder are:
qatomic_armv5.h
qatomic_armv6.h
qatomic_armv7.h
qatomic_bootstrap.h
qatomic_cxx11.h
qatomic_gcc.h
qatomic_ia64.h
qatomic_mips.h
qatomic_msvc.h
qatomic_unix.h
qatomic_x86.h
qconfig-dist.h
qconfig.h
qconfig-large.h
qconfig-medium.h
qconfig-minimal.h
qconfig-nacl.h
qconfig-small.h
qobjectdefs_impl.h
qobject_impl.h
qsharedpointer_impl.h
qt_windows.h
I *could* include qatomic_x86.h to the modulemap, but that header is not
designed for users to include. Users include qatomic.h instead, which
includes the appropriate _foo header.
The _impl headers are also not designed to be included directly, so not
including those in the modulemap also makes sense to me. I suppose the
appropriate version gets compiled into the module binary file included via
the public header.
I guess on windows, qt_windows.h would need to be included in the modulemap
(assuming windows.h was in another module, probably). So, we would have to
generate the modulemap at the time of building/packaging Qt.
Thanks,
Steve.
More information about the cfe-dev
mailing list