[compiler-rt] Exclude compiler-rt from using -fmodules when LLVM_ENABLE_MODULES=On

Sanitizers are intentionally not including system headers and often declare slightly different function prototypes, which is incompatible with -fmodules and -fcxx-modules. Let’s simply exclude compiler-rt from using -fmodules.

Differential Revision: https://reviews.llvm.org/D25230

llvm-svn: 283658
This commit is contained in:
Kuba Brecka 2016-10-08 09:01:27 +00:00
parent e0bcdd4d25
commit ab61c74f93

View File

@ -205,6 +205,12 @@ elseif(MSVC)
llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Z[i7I]" "/Z7")
endif()
if(LLVM_ENABLE_MODULES)
# Sanitizers cannot be built with -fmodules. The interceptors intentionally
# don't include system headers, which is incompatible with modules.
list(APPEND SANITIZER_COMMON_CFLAGS -fno-modules)
endif()
# Turn off several warnings.
append_list_if(COMPILER_RT_HAS_WGNU_FLAG -Wno-gnu SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG -Wno-variadic-macros SANITIZER_COMMON_CFLAGS)