Index: vendor/libc++/dist-release_80/cmake/Modules/HandleOutOfTreeLLVM.cmake =================================================================== --- vendor/libc++/dist-release_80/cmake/Modules/HandleOutOfTreeLLVM.cmake (revision 343799) +++ vendor/libc++/dist-release_80/cmake/Modules/HandleOutOfTreeLLVM.cmake (revision 343800) @@ -1,139 +1,139 @@ macro(find_llvm_parts) # Rely on llvm-config. set(CONFIG_OUTPUT) if(NOT LLVM_CONFIG_PATH) find_program(LLVM_CONFIG_PATH "llvm-config") endif() if(DEFINED LLVM_PATH) set(LLVM_INCLUDE_DIR ${LLVM_INCLUDE_DIR} CACHE PATH "Path to llvm/include") set(LLVM_PATH ${LLVM_PATH} CACHE PATH "Path to LLVM source tree") set(LLVM_MAIN_SRC_DIR ${LLVM_PATH}) set(LLVM_CMAKE_PATH "${LLVM_PATH}/cmake/modules") elseif(LLVM_CONFIG_PATH) message(STATUS "Found LLVM_CONFIG_PATH as ${LLVM_CONFIG_PATH}") set(LIBCXX_USING_INSTALLED_LLVM 1) set(CONFIG_COMMAND ${LLVM_CONFIG_PATH} "--includedir" "--prefix" "--src-root") execute_process( COMMAND ${CONFIG_COMMAND} RESULT_VARIABLE HAD_ERROR OUTPUT_VARIABLE CONFIG_OUTPUT ) if(NOT HAD_ERROR) string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" CONFIG_OUTPUT ${CONFIG_OUTPUT}) else() string(REPLACE ";" " " CONFIG_COMMAND_STR "${CONFIG_COMMAND}") message(STATUS "${CONFIG_COMMAND_STR}") message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}") endif() list(GET CONFIG_OUTPUT 0 INCLUDE_DIR) list(GET CONFIG_OUTPUT 1 LLVM_OBJ_ROOT) list(GET CONFIG_OUTPUT 2 MAIN_SRC_DIR) set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include") set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree") set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree") # --cmakedir is supported since llvm r291218 (4.0 release) execute_process( COMMAND ${LLVM_CONFIG_PATH} --cmakedir RESULT_VARIABLE HAD_ERROR OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH) else() file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE) set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() set(LLVM_FOUND OFF) message(WARNING "UNSUPPORTED LIBCXX CONFIGURATION DETECTED: " "llvm-config not found and LLVM_PATH not defined.\n" "Reconfigure with -DLLVM_CONFIG_PATH=path/to/llvm-config " "or -DLLVM_PATH=path/to/llvm-source-root.") return() endif() if (EXISTS "${LLVM_CMAKE_PATH}") list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}") elseif (EXISTS "${LLVM_MAIN_SRC_DIR}/cmake/modules") list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules") else() set(LLVM_FOUND OFF) message(WARNING "Neither ${LLVM_CMAKE_PATH} nor ${LLVM_MAIN_SRC_DIR}/cmake/modules found") return() endif() set(LLVM_FOUND ON) endmacro(find_llvm_parts) macro(configure_out_of_tree_llvm) message(STATUS "Configuring for standalone build.") set(LIBCXX_STANDALONE_BUILD 1) find_llvm_parts() # Add LLVM Functions -------------------------------------------------------- if (LLVM_FOUND AND LIBCXX_USING_INSTALLED_LLVM) include(LLVMConfig) # For TARGET_TRIPLE else() if (WIN32) set(LLVM_ON_UNIX 0) set(LLVM_ON_WIN32 1) else() set(LLVM_ON_UNIX 1) set(LLVM_ON_WIN32 0) endif() endif() if (LLVM_FOUND) include(AddLLVM OPTIONAL) endif() # LLVM Options -------------------------------------------------------------- if (NOT DEFINED LLVM_INCLUDE_TESTS) set(LLVM_INCLUDE_TESTS ${LLVM_FOUND}) endif() if (NOT DEFINED LLVM_INCLUDE_DOCS) set(LLVM_INCLUDE_DOCS ${LLVM_FOUND}) endif() if (NOT DEFINED LLVM_ENABLE_SPHINX) set(LLVM_ENABLE_SPHINX OFF) endif() # In a standalone build, we don't have llvm to automatically generate the # llvm-lit script for us. So we need to provide an explicit directory that # the configurator should write the script into. set(LLVM_LIT_OUTPUT_DIR "${libcxx_BINARY_DIR}/bin") if (LLVM_INCLUDE_TESTS) # Required LIT Configuration ------------------------------------------------ # Define the default arguments to use with 'lit', and an option for the user # to override. - set(LLVM_EXTERNAL_LIT "${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py") + set(LLVM_DEFAULT_EXTERNAL_LIT "${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py") set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported") if (MSVC OR XCODE) set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar") endif() set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit") endif() # Required doc configuration if (LLVM_ENABLE_SPHINX) find_package(Sphinx REQUIRED) endif() if (LLVM_ON_UNIX AND NOT APPLE) set(LLVM_HAVE_LINK_VERSION_SCRIPT 1) else() set(LLVM_HAVE_LINK_VERSION_SCRIPT 0) endif() endmacro(configure_out_of_tree_llvm) configure_out_of_tree_llvm() Index: vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp =================================================================== --- vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp (revision 343799) +++ vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp (revision 343800) @@ -1,115 +1,117 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // test aligned operator delete replacement. // UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14 // Older Clang versions do not support this // UNSUPPORTED: clang-3, apple-clang-7, apple-clang-8 // None of the current GCC compilers support this. // UNSUPPORTED: gcc-5, gcc-6 -// Aligned allocation was not provided before macosx10.12 and as a result we -// get availability errors when the deployment target is older than macosx10.13. -// However, AppleClang 10 (and older) don't trigger availability errors. +// Aligned allocation was not provided before macosx10.14 and as a result we +// get availability errors when the deployment target is older than macosx10.14. +// However, AppleClang 10 (and older) don't trigger availability errors, and +// Clang < 8.0 doesn't warn for 10.13. +// XFAIL: !(apple-clang-9 || apple-clang-10 || clang-7) && availability=macosx10.13 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7 // On AppleClang 10 (and older), instead of getting an availability failure // like above, we get a link error when we link against a dylib that does // not export the aligned allocation functions. // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7 // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails to compile/link. // XFAIL: LIBCXX-WINDOWS-FIXME #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; int unsized_delete_called = 0; int unsized_delete_nothrow_called = 0; int aligned_delete_called = 0; void reset() { unsized_delete_called = 0; unsized_delete_nothrow_called = 0; aligned_delete_called = 0; } void operator delete(void* p) TEST_NOEXCEPT { ++unsized_delete_called; std::free(p); } void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT { ++unsized_delete_nothrow_called; std::free(p); } void operator delete [] (void* p, std::align_val_t) TEST_NOEXCEPT { ++aligned_delete_called; std::free(p); } struct alignas(OverAligned) A {}; struct alignas(std::max_align_t) B {}; int main() { reset(); { B *b = new B[2]; DoNotOptimize(b); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete [] b; DoNotOptimize(b); assert(1 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); } reset(); { A *a = new A[2]; DoNotOptimize(a); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete [] a; DoNotOptimize(a); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(1 == aligned_delete_called); } } Index: vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp =================================================================== --- vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp (revision 343799) +++ vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp (revision 343800) @@ -1,105 +1,107 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 // asan and msan will not call the new handler. // UNSUPPORTED: sanitizer-new-delete // FIXME change this to XFAIL. // UNSUPPORTED: no-aligned-allocation && !gcc -// Aligned allocation was not provided before macosx10.12 and as a result we -// get availability errors when the deployment target is older than macosx10.13. -// However, AppleClang 10 (and older) don't trigger availability errors. +// Aligned allocation was not provided before macosx10.14 and as a result we +// get availability errors when the deployment target is older than macosx10.14. +// However, AppleClang 10 (and older) don't trigger availability errors, and +// Clang < 8.0 doesn't warn for 10.13. +// XFAIL: !(apple-clang-9 || apple-clang-10 || clang-7) && availability=macosx10.13 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7 // On AppleClang 10 (and older), instead of getting an availability failure // like above, we get a link error when we link against a dylib that does // not export the aligned allocation functions. // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7 // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails to link. // XFAIL: LIBCXX-WINDOWS-FIXME // test operator new #include #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; int new_handler_called = 0; void my_new_handler() { ++new_handler_called; std::set_new_handler(0); } int A_constructed = 0; struct alignas(OverAligned) A { A() { ++A_constructed;} ~A() { --A_constructed;} }; void test_throw_max_size() { #ifndef TEST_HAS_NO_EXCEPTIONS std::set_new_handler(my_new_handler); try { void* vp = operator new[] (std::numeric_limits::max(), static_cast(32)); ((void)vp); assert(false); } catch (std::bad_alloc&) { assert(new_handler_called == 1); } catch (...) { assert(false); } #endif } int main() { { A* ap = new A[2]; assert(ap); assert(reinterpret_cast(ap) % OverAligned == 0); assert(A_constructed == 2); delete [] ap; assert(A_constructed == 0); } { test_throw_max_size(); } } Index: vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp =================================================================== --- vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp (revision 343799) +++ vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp (revision 343800) @@ -1,107 +1,109 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 // asan and msan will not call the new handler. // UNSUPPORTED: sanitizer-new-delete // FIXME turn this into an XFAIL // UNSUPPORTED: no-aligned-allocation && !gcc -// Aligned allocation was not provided before macosx10.12 and as a result we -// get availability errors when the deployment target is older than macosx10.13. -// However, AppleClang 10 (and older) don't trigger availability errors. +// Aligned allocation was not provided before macosx10.14 and as a result we +// get availability errors when the deployment target is older than macosx10.14. +// However, AppleClang 10 (and older) don't trigger availability errors, and +// Clang < 8.0 doesn't warn for 10.13. +// XFAIL: !(apple-clang-9 || apple-clang-10 || clang-7) && availability=macosx10.13 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7 // On AppleClang 10 (and older), instead of getting an availability failure // like above, we get a link error when we link against a dylib that does // not export the aligned allocation functions. // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7 // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails to compile/link. // XFAIL: LIBCXX-WINDOWS-FIXME // test operator new (nothrow) #include #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; int new_handler_called = 0; void my_new_handler() { ++new_handler_called; std::set_new_handler(0); } int A_constructed = 0; struct alignas(OverAligned) A { A() { ++A_constructed; } ~A() { --A_constructed; } }; void test_max_alloc() { std::set_new_handler(my_new_handler); auto do_test = []() { void* vp = operator new [](std::numeric_limits::max(), std::align_val_t(OverAligned), std::nothrow); assert(new_handler_called == 1); assert(vp == 0); }; #ifndef TEST_HAS_NO_EXCEPTIONS try { do_test(); } catch (...) { assert(false); } #else do_test(); #endif } int main() { { A* ap = new(std::nothrow) A[3]; assert(ap); assert(reinterpret_cast(ap) % OverAligned == 0); assert(A_constructed == 3); delete [] ap; assert(!A_constructed); } { test_max_alloc(); } } Index: vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp =================================================================== --- vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp (revision 343799) +++ vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp (revision 343800) @@ -1,108 +1,110 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: sanitizer-new-delete -// Aligned allocation was not provided before macosx10.12 and as a result we -// get availability errors when the deployment target is older than macosx10.13. -// However, AppleClang 10 (and older) don't trigger availability errors. +// Aligned allocation was not provided before macosx10.14 and as a result we +// get availability errors when the deployment target is older than macosx10.14. +// However, AppleClang 10 (and older) don't trigger availability errors, and +// Clang < 8.0 doesn't warn for 10.13. +// XFAIL: !(apple-clang-9 || apple-clang-10 || clang-7) && availability=macosx10.13 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7 // On AppleClang 10 (and older), instead of getting an availability failure // like above, we get a link error when we link against a dylib that does // not export the aligned allocation functions. // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7 // XFAIL: no-aligned-allocation && !gcc // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails. // XFAIL: LIBCXX-WINDOWS-FIXME // test operator new nothrow by replacing only operator new #include #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; int A_constructed = 0; struct alignas(OverAligned) A { A() {++A_constructed;} ~A() {--A_constructed;} }; int B_constructed = 0; struct B { std::max_align_t member; B() { ++B_constructed; } ~B() { --B_constructed; } }; int new_called = 0; alignas(OverAligned) char Buff[OverAligned * 3]; void* operator new[](std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad_alloc) { assert(!new_called); assert(s <= sizeof(Buff)); assert(static_cast(a) == OverAligned); ++new_called; return Buff; } void operator delete[](void* p, std::align_val_t a) TEST_NOEXCEPT { assert(p == Buff); assert(static_cast(a) == OverAligned); assert(new_called); --new_called; } int main() { { A* ap = new (std::nothrow) A[2]; assert(ap); assert(A_constructed == 2); assert(new_called); delete [] ap; assert(A_constructed == 0); assert(!new_called); } { B* bp = new (std::nothrow) B[2]; assert(bp); assert(B_constructed == 2); assert(!new_called); delete [] bp; assert(!new_called); assert(!B_constructed); } } Index: vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp =================================================================== --- vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp (revision 343799) +++ vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp (revision 343800) @@ -1,114 +1,116 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // test aligned operator delete replacement. // UNSUPPORTED: sanitizer-new-delete, c++98, c++03, c++11, c++14 // Older Clang versions do not support this // UNSUPPORTED: clang-3, apple-clang-7, apple-clang-8 // None of the current GCC compilers support this. // UNSUPPORTED: gcc-5, gcc-6 -// Aligned allocation was not provided before macosx10.12 and as a result we -// get availability errors when the deployment target is older than macosx10.13. -// However, AppleClang 10 (and older) don't trigger availability errors. +// Aligned allocation was not provided before macosx10.14 and as a result we +// get availability errors when the deployment target is older than macosx10.14. +// However, AppleClang 10 (and older) don't trigger availability errors, and +// Clang < 8.0 doesn't warn for 10.13 +// XFAIL: !(apple-clang-9 || apple-clang-10 || clang-7) && availability=macosx10.13 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7 // On AppleClang 10 (and older), instead of getting an availability failure // like above, we get a link error when we link against a dylib that does // not export the aligned allocation functions. // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7 // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails to compile/link. // XFAIL: LIBCXX-WINDOWS-FIXME #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; int unsized_delete_called = 0; int unsized_delete_nothrow_called = 0; int aligned_delete_called = 0; void reset() { unsized_delete_called = 0; unsized_delete_nothrow_called = 0; aligned_delete_called = 0; } void operator delete(void* p) TEST_NOEXCEPT { ++unsized_delete_called; std::free(p); } void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT { ++unsized_delete_nothrow_called; std::free(p); } void operator delete(void* p, std::align_val_t) TEST_NOEXCEPT { ++aligned_delete_called; std::free(p); } struct alignas(OverAligned) A {}; struct alignas(std::max_align_t) B {}; int main() { reset(); { B *bp = new B; DoNotOptimize(bp); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete bp; DoNotOptimize(bp); assert(1 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); } reset(); { A *ap = new A; DoNotOptimize(ap); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(0 == aligned_delete_called); delete ap; DoNotOptimize(ap); assert(0 == unsized_delete_called); assert(0 == unsized_delete_nothrow_called); assert(1 == aligned_delete_called); } } Index: vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp =================================================================== --- vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp (revision 343799) +++ vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp (revision 343800) @@ -1,105 +1,107 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 -// Aligned allocation was not provided before macosx10.12 and as a result we -// get availability errors when the deployment target is older than macosx10.13. -// However, AppleClang 10 (and older) don't trigger availability errors. +// Aligned allocation was not provided before macosx10.14 and as a result we +// get availability errors when the deployment target is older than macosx10.14. +// However, AppleClang 10 (and older) don't trigger availability errors, and +// Clang < 8.0 doesn't warn for 10.13. +// XFAIL: !(apple-clang-9 || apple-clang-10 || clang-7) && availability=macosx10.13 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7 // On AppleClang 10 (and older), instead of getting an availability failure // like above, we get a link error when we link against a dylib that does // not export the aligned allocation functions. // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7 // asan and msan will not call the new handler. // UNSUPPORTED: sanitizer-new-delete // FIXME turn this into an XFAIL // UNSUPPORTED: no-aligned-allocation && !gcc // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails to compile/link. // XFAIL: LIBCXX-WINDOWS-FIXME // test operator new #include #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; int new_handler_called = 0; void my_new_handler() { ++new_handler_called; std::set_new_handler(0); } bool A_constructed = false; struct alignas(OverAligned) A { A() {A_constructed = true;} ~A() {A_constructed = false;} }; void test_throw_max_size() { #ifndef TEST_HAS_NO_EXCEPTIONS std::set_new_handler(my_new_handler); try { void* vp = operator new (std::numeric_limits::max(), static_cast(32)); ((void)vp); assert(false); } catch (std::bad_alloc&) { assert(new_handler_called == 1); } catch (...) { assert(false); } #endif } int main() { { A* ap = new A; assert(ap); assert(reinterpret_cast(ap) % OverAligned == 0); assert(A_constructed); delete ap; assert(!A_constructed); } { test_throw_max_size(); } } Index: vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp =================================================================== --- vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp (revision 343799) +++ vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp (revision 343800) @@ -1,107 +1,109 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 -// Aligned allocation was not provided before macosx10.12 and as a result we -// get availability errors when the deployment target is older than macosx10.13. -// However, AppleClang 10 (and older) don't trigger availability errors. +// Aligned allocation was not provided before macosx10.14 and as a result we +// get availability errors when the deployment target is older than macosx10.14. +// However, AppleClang 10 (and older) don't trigger availability errors, and +// Clang < 8.0 doesn't warn for 10.13 +// XFAIL: !(apple-clang-9 || apple-clang-10 || clang-7) && availability=macosx10.13 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7 // On AppleClang 10 (and older), instead of getting an availability failure // like above, we get a link error when we link against a dylib that does // not export the aligned allocation functions. // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7 // asan and msan will not call the new handler. // UNSUPPORTED: sanitizer-new-delete // FIXME turn this into an XFAIL // UNSUPPORTED: no-aligned-allocation && !gcc // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails to compile/link. // XFAIL: LIBCXX-WINDOWS-FIXME // test operator new (nothrow) #include #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; int new_handler_called = 0; void my_new_handler() { ++new_handler_called; std::set_new_handler(0); } bool A_constructed = false; struct alignas(OverAligned) A { A() {A_constructed = true;} ~A() {A_constructed = false;} }; void test_max_alloc() { std::set_new_handler(my_new_handler); auto do_test = []() { void* vp = operator new (std::numeric_limits::max(), std::align_val_t(OverAligned), std::nothrow); assert(new_handler_called == 1); assert(vp == 0); }; #ifndef TEST_HAS_NO_EXCEPTIONS try { do_test(); } catch (...) { assert(false); } #else do_test(); #endif } int main() { { A* ap = new(std::nothrow) A; assert(ap); assert(reinterpret_cast(ap) % OverAligned == 0); assert(A_constructed); delete ap; assert(!A_constructed); } { test_max_alloc(); } } Index: vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp =================================================================== --- vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp (revision 343799) +++ vendor/libc++/dist-release_80/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp (revision 343800) @@ -1,110 +1,112 @@ //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 // UNSUPPORTED: sanitizer-new-delete -// Aligned allocation was not provided before macosx10.12 and as a result we -// get availability errors when the deployment target is older than macosx10.13. -// However, AppleClang 10 (and older) don't trigger availability errors. +// Aligned allocation was not provided before macosx10.14 and as a result we +// get availability errors when the deployment target is older than macosx10.14. +// However, AppleClang 10 (and older) don't trigger availability errors, and +// Clang < 8.0 doesn't warn for 10.13 +// XFAIL: !(apple-clang-9 || apple-clang-10 || clang-7) && availability=macosx10.13 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.12 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.11 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.10 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.9 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.8 // XFAIL: !(apple-clang-9 || apple-clang-10) && availability=macosx10.7 // On AppleClang 10 (and older), instead of getting an availability failure // like above, we get a link error when we link against a dylib that does // not export the aligned allocation functions. // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.12 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.11 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.10 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.9 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.8 // XFAIL: (apple-clang-9 || apple-clang-10) && with_system_cxx_lib=macosx10.7 // NOTE: gcc doesn't provide -faligned-allocation flag to test for // XFAIL: no-aligned-allocation && !gcc // On Windows libc++ doesn't provide its own definitions for new/delete // but instead depends on the ones in VCRuntime. However VCRuntime does not // yet provide aligned new/delete definitions so this test fails. // XFAIL: LIBCXX-WINDOWS-FIXME // test operator new nothrow by replacing only operator new #include #include #include #include #include #include "test_macros.h" constexpr auto OverAligned = __STDCPP_DEFAULT_NEW_ALIGNMENT__ * 2; bool A_constructed = false; struct alignas(OverAligned) A { A() {A_constructed = true;} ~A() {A_constructed = false;} }; bool B_constructed = false; struct B { std::max_align_t member; B() { B_constructed = true; } ~B() { B_constructed = false; } }; int new_called = 0; alignas(OverAligned) char Buff[OverAligned * 2]; void* operator new(std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad_alloc) { assert(!new_called); assert(s <= sizeof(Buff)); assert(static_cast(a) == OverAligned); ++new_called; return Buff; } void operator delete(void* p, std::align_val_t a) TEST_NOEXCEPT { assert(p == Buff); assert(static_cast(a) == OverAligned); assert(new_called); --new_called; } int main() { { A* ap = new (std::nothrow) A; assert(ap); assert(A_constructed); assert(new_called); delete ap; assert(!A_constructed); assert(!new_called); } { B* bp = new (std::nothrow) B; assert(bp); assert(B_constructed); assert(!new_called); delete bp; assert(!new_called); assert(!B_constructed); } }