mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
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. llvm-svn: 266502
This commit is contained in:
parent
0024f020dc
commit
c8f9cc971a
@ -139,6 +139,25 @@ function(add_flag_or_print_warning flag name)
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
if (LLVM_ENABLE_MODULES)
|
||||||
|
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fmodules -Xclang -fmodules-local-submodule-visibility")
|
||||||
|
# Check that we can build code with modules enabled, and that repeatedly
|
||||||
|
# including <cassert> still manages to respect NDEBUG properly.
|
||||||
|
CHECK_CXX_SOURCE_COMPILES("#undef NDEBUG
|
||||||
|
#include <cassert>
|
||||||
|
#define NDEBUG
|
||||||
|
#include <cassert>
|
||||||
|
int main() { assert(this code is not compiled); }"
|
||||||
|
CXX_SUPPORTS_MODULES)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||||
|
if (CXX_SUPPORTS_MODULES)
|
||||||
|
append_if(CXX_SUPPORTS_MODULES "-fmodules -Xclang -fmodules-local-submodule-visibility" CMAKE_CXX_FLAGS)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "LLVM_ENABLE_MODULES is not supported by this compiler")
|
||||||
|
endif()
|
||||||
|
endif(LLVM_ENABLE_MODULES)
|
||||||
|
|
||||||
if( LLVM_ENABLE_PIC )
|
if( LLVM_ENABLE_PIC )
|
||||||
if( XCODE )
|
if( XCODE )
|
||||||
# Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't
|
# Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't
|
||||||
@ -471,25 +490,6 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
|
|||||||
message(FATAL_ERROR "LLVM requires C++11 support but the '-std=c++11' flag isn't supported.")
|
message(FATAL_ERROR "LLVM requires C++11 support but the '-std=c++11' flag isn't supported.")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if (LLVM_ENABLE_MODULES)
|
|
||||||
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
|
||||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fmodules")
|
|
||||||
# Check that we can build code with modules enabled, and that repeatedly
|
|
||||||
# including <cassert> still manages to respect NDEBUG properly.
|
|
||||||
CHECK_CXX_SOURCE_COMPILES("#undef NDEBUG
|
|
||||||
#include <cassert>
|
|
||||||
#define NDEBUG
|
|
||||||
#include <cassert>
|
|
||||||
int main() { assert(this code is not compiled); }"
|
|
||||||
CXX_SUPPORTS_MODULES)
|
|
||||||
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
|
||||||
if (CXX_SUPPORTS_MODULES)
|
|
||||||
append_if(CXX_SUPPORTS_MODULES "-fmodules" CMAKE_C_FLAGS)
|
|
||||||
append_if(CXX_SUPPORTS_MODULES "-fmodules -fcxx-modules" CMAKE_CXX_FLAGS)
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "LLVM_ENABLE_MODULES is not supported by this compiler")
|
|
||||||
endif()
|
|
||||||
endif(LLVM_ENABLE_MODULES)
|
|
||||||
endif( MSVC )
|
endif( MSVC )
|
||||||
|
|
||||||
macro(append_common_sanitizer_flags)
|
macro(append_common_sanitizer_flags)
|
||||||
|
@ -1 +0,0 @@
|
|||||||
module AsmParser { requires cplusplus umbrella "." module * { export * } }
|
|
@ -1 +0,0 @@
|
|||||||
module Bitcode { requires cplusplus umbrella "." module * { export * } }
|
|
@ -1 +0,0 @@
|
|||||||
module CodeGen { requires cplusplus umbrella "." module * { export * } }
|
|
@ -1 +0,0 @@
|
|||||||
module DebugInfoDWARF { requires cplusplus umbrella "." module * { export * } }
|
|
@ -1 +0,0 @@
|
|||||||
module IR { requires cplusplus umbrella "." module * { export * } }
|
|
@ -1 +0,0 @@
|
|||||||
module TableGen { requires cplusplus umbrella "." module * { export * } }
|
|
@ -1,4 +0,0 @@
|
|||||||
module TableGen {
|
|
||||||
umbrella "."
|
|
||||||
module * { export * }
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user