diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -588,6 +588,12 @@ check_cxx_compiler_flag("-Wclass-memaccess" CXX_SUPPORTS_CLASS_MEMACCESS_FLAG) append_if(CXX_SUPPORTS_CLASS_MEMACCESS_FLAG "-Wno-class-memaccess" CMAKE_CXX_FLAGS) + # A GCC 9 warning triggered by ArrayRef. + check_cxx_compiler_flag("-Winit-list-lifetime" + CXX_SUPPORTS_INIT_LIST_LIFETIME_FLAG) + append_if(CXX_SUPPORTS_INIT_LIST_LIFETIME_FLAG "-Wno-init-list-lifetime" + CMAKE_CXX_FLAGS) + # The LLVM libraries have no stable C++ API, so -Wnoexcept-type is not useful. check_cxx_compiler_flag("-Wnoexcept-type" CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG) append_if(CXX_SUPPORTS_NOEXCEPT_TYPE_FLAG "-Wno-noexcept-type" CMAKE_CXX_FLAGS)