[libcxx] r284230 - Disable Modules when building the libc++ sources.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 14 05:56:52 PDT 2016

Author: ericwf
Date: Fri Oct 14 07:56:52 2016
New Revision: 284230

URL: http://llvm.org/viewvc/llvm-project?rev=284230&view=rev
Disable Modules when building the libc++ sources.

Libc++ will not build with modules enabled. In order to support an in-tree
libc++ when LLVM_ENABLE_MODULES is ON we need to explicitly disable the feature.

Unfortunately the libc++ sources are fundamentally non-modular. For example
iostream.cpp defines cout, cerr, wout, ... as char buffers instead of streams
in order to better control initialization/destruction. Not shockingly Clang
diagnoses this. Many other sources files define _LIBCPP_BUILDING_FOO macros to
provide definitions for normally inline symbols (See bind.cpp). Finally The
current module.map prohibits using <strstream> in C++11 so we can't build

I think I can fix most of these issues but until then just disable modules.


Modified: libcxx/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=284230&r1=284229&r2=284230&view=diff
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Fri Oct 14 07:56:52 2016
@@ -411,6 +411,16 @@ endif()
 # Feature flags ===============================================================
+# Modules flags ===============================================================
+# FIXME The libc++ sources are fundamentally non-modular. They need special
+# versions of the headers in order to provide C++03 and legacy ABI definitions.
+# NOTE: The public headers can be used with modules in all other contexts.
+  # Ignore that the rest of the modules flags are now unused.
+  add_compile_flags_if_supported(-Wno-unused-command-line-argument)
+  add_compile_flags(-fno-modules)
 # Sanitizer flags =============================================================
 # Configure for sanitizers. If LIBCXX_STANDALONE_BUILD then we have to do

More information about the cfe-commits mailing list