llvm.org GIT mirror llvm / 43ef70d
Update and fix LLVM_ENABLE_MODULES: 1) We need to add this flag prior to adding any other, in case the user has specified a -fmodule-cache-path= flag in their custom CXXFLAGS. Such a flag causes -Werror builds to fail, and thus all config checks fail, until we add the corresponding -fmodules flag. The modules selfhost bot does this, for instance. 2) Delete module maps that were putting .cpp files into modules. 3) Enable -fmodules-local-submodule-visibility, to get proper module visibility rules applied across submodules of the same module. Disable -fmodules for C builds, since that flag is not available there. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266502 91177308-0d34-0410-b5e6-96231b3b80d8 Richard Smith 4 years ago
8 changed file(s) with 19 addition(s) and 29 deletion(s). Raw diff Collapse all Expand all
137137 message(WARNING "${flag} is not supported.")
138138 endif()
139139 endfunction()
140
141 if (LLVM_ENABLE_MODULES)
142 set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
143 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fmodules -Xclang -fmodules-local-submodule-visibility")
144 # Check that we can build code with modules enabled, and that repeatedly
145 # including still manages to respect NDEBUG properly.
146 CHECK_CXX_SOURCE_COMPILES("#undef NDEBUG
147 #include
148 #define NDEBUG
149 #include
150 int main() { assert(this code is not compiled); }"
151 CXX_SUPPORTS_MODULES)
152 set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
153 if (CXX_SUPPORTS_MODULES)
154 append_if(CXX_SUPPORTS_MODULES "-fmodules -Xclang -fmodules-local-submodule-visibility" CMAKE_CXX_FLAGS)
155 else()
156 message(FATAL_ERROR "LLVM_ENABLE_MODULES is not supported by this compiler")
157 endif()
158 endif(LLVM_ENABLE_MODULES)
140159
141160 if( LLVM_ENABLE_PIC )
142161 if( XCODE )
470489 message(FATAL_ERROR "LLVM requires C++11 support but the '-std=c++11' flag isn't supported.")
471490 endif()
472491 endif()
473 if (LLVM_ENABLE_MODULES)
474 set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
475 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fmodules")
476 # Check that we can build code with modules enabled, and that repeatedly
477 # including still manages to respect NDEBUG properly.
478 CHECK_CXX_SOURCE_COMPILES("#undef NDEBUG
479 #include
480 #define NDEBUG
481 #include
482 int main() { assert(this code is not compiled); }"
483 CXX_SUPPORTS_MODULES)
484 set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
485 if (CXX_SUPPORTS_MODULES)
486 append_if(CXX_SUPPORTS_MODULES "-fmodules" CMAKE_C_FLAGS)
487 append_if(CXX_SUPPORTS_MODULES "-fmodules -fcxx-modules" CMAKE_CXX_FLAGS)
488 else()
489 message(FATAL_ERROR "LLVM_ENABLE_MODULES is not supported by this compiler")
490 endif()
491 endif(LLVM_ENABLE_MODULES)
492492 endif( MSVC )
493493
494494 macro(append_common_sanitizer_flags)
+0
-1
lib/AsmParser/module.modulemap less more
None module AsmParser { requires cplusplus umbrella "." module * { export * } }
+0
-1
lib/Bitcode/module.modulemap less more
None module Bitcode { requires cplusplus umbrella "." module * { export * } }
+0
-1
lib/CodeGen/module.modulemap less more
None module CodeGen { requires cplusplus umbrella "." module * { export * } }
+0
-1
lib/DebugInfo/DWARF/module.modulemap less more
None module DebugInfoDWARF { requires cplusplus umbrella "." module * { export * } }
+0
-1
lib/IR/module.modulemap less more
None module IR { requires cplusplus umbrella "." module * { export * } }
+0
-1
lib/TableGen/module.modulemap less more
None module TableGen { requires cplusplus umbrella "." module * { export * } }
+0
-4
utils/TableGen/module.modulemap less more
None module TableGen {
1 umbrella "."
2 module * { export * }
3 }