diff --git a/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in b/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in --- a/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in +++ b/libcxx/test/configs/llvm-libc++-shared-clangcl.cfg.in @@ -3,12 +3,19 @@ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') +dbg_include = '' +lib_suffix = '' + +if '@uppercase_CMAKE_BUILD_TYPE@' == 'DEBUG': + dbg_include = ' -D_DEBUG -include set_windows_crt_report_mode.h' + lib_suffix = 'd' + config.substitutions.append(('%{flags}', '--driver-mode=g++')) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' + '-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' + dbg_include )) config.substitutions.append(('%{link_flags}', - '-nostdlib -L %{lib} -lc++ -lmsvcrt -lmsvcprt -loldnames' + '-nostdlib -L %%{lib} -lc++ -lmsvcrt%s -lmsvcprt%s -loldnames' % (lib_suffix, lib_suffix) )) config.substitutions.append(('%{exec}', '%{executor} --execdir %T --prepend_env PATH=%{lib} -- ' diff --git a/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in b/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in --- a/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in +++ b/libcxx/test/configs/llvm-libc++-shared-no-vcruntime-clangcl.cfg.in @@ -4,12 +4,19 @@ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') +dbg_include = '' +lib_suffix = '' + +if '@uppercase_CMAKE_BUILD_TYPE@' == 'DEBUG': + dbg_include = ' -D_DEBUG -include set_windows_crt_report_mode.h' + lib_suffix = 'd' + config.substitutions.append(('%{flags}', '--driver-mode=g++')) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX -D_HAS_EXCEPTIONS=0' + '-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX -D_HAS_EXCEPTIONS=0' + dbg_include )) config.substitutions.append(('%{link_flags}', - '-nostdlib -L %{lib} -lc++ -lmsvcrt -lmsvcprt -loldnames' + '-nostdlib -L %%{lib} -lc++ -lmsvcrt%s -lmsvcprt%s -loldnames' % (lib_suffix, lib_suffix) )) config.substitutions.append(('%{exec}', '%{executor} --execdir %T --prepend_env PATH=%{lib} -- ' diff --git a/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in b/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in --- a/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in +++ b/libcxx/test/configs/llvm-libc++-static-clangcl.cfg.in @@ -3,12 +3,19 @@ lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg') +dbg_include = '' +lib_suffix = '' + +if '@uppercase_CMAKE_BUILD_TYPE@' == 'DEBUG': + dbg_include = ' -D_DEBUG -include set_windows_crt_report_mode.h' + lib_suffix = 'd' + config.substitutions.append(('%{flags}', '--driver-mode=g++')) config.substitutions.append(('%{compile_flags}', - '-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' + '-nostdinc++ -I %{include} -I %{target-include} -I %{libcxx}/test/support -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_STDIO_ISO_WIDE_SPECIFIERS -DNOMINMAX' + dbg_include )) config.substitutions.append(('%{link_flags}', - '-nostdlib -L %{lib} -llibc++ -lmsvcrt -lmsvcprt -loldnames' + '-nostdlib -L %%{lib} -llibc++ -lmsvcrt%s -lmsvcprt%s -loldnames' % (lib_suffix, lib_suffix) )) config.substitutions.append(('%{exec}', '%{executor} --execdir %T -- ' diff --git a/libcxx/test/support/set_windows_crt_report_mode.h b/libcxx/test/support/set_windows_crt_report_mode.h --- a/libcxx/test/support/set_windows_crt_report_mode.h +++ b/libcxx/test/support/set_windows_crt_report_mode.h @@ -10,6 +10,14 @@ #ifndef SUPPORT_SET_WINDOWS_CRT_REPORT_MODE_H #define SUPPORT_SET_WINDOWS_CRT_REPORT_MODE_H +// A few tests are built in C mode or in C++03 mode. The initialization +// of init_crt_anchor is a C++ feature, and ends up including +// MSVC header code which breaks in C++03 mode. Therefore, only expand +// the body of this header when included in C++ >= 11 mode. As this file +// is included in every single translation unit, we're intentionally not +// including test_macros.h (for TEST_STD_VER) but try to keep it to the +// bare minimum. +#if defined(__cplusplus) && __cplusplus > 199711L #ifndef _DEBUG #error _DEBUG must be defined when using this header #endif @@ -32,5 +40,6 @@ } static int init_crt_anchor = init_crt_report_mode(); +#endif // defined(__cplusplus) && __cplusplus > 199711L #endif // SUPPORT_SET_WINDOWS_CRT_REPORT_MODE_H diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml --- a/libcxx/utils/ci/buildkite-pipeline.yml +++ b/libcxx/utils/ci/buildkite-pipeline.yml @@ -764,6 +764,19 @@ - exit_status: -1 # Agent was lost limit: 2 + - label: "Clang-cl (Debug mode)" + command: "bash libcxx/utils/ci/run-buildbot clang-cl-debug" + artifact_paths: + - "**/test-results.xml" + - "**/*.abilist" + agents: + queue: "windows" + retry: + automatic: + - exit_status: -1 # Agent was lost + limit: 2 + timeout_in_minutes: 120 + - label: "MinGW (DLL, x86_64)" command: "bash libcxx/utils/ci/run-buildbot mingw-dll" artifact_paths: diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -639,6 +639,13 @@ echo "+++ Running the libc++ tests" ${NINJA} -vC "${BUILD_DIR}" check-cxx ;; +clang-cl-debug) + clean + generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False" \ + -DCMAKE_BUILD_TYPE=Debug + echo "+++ Running the libc++ tests" + ${NINJA} -vC "${BUILD_DIR}" check-cxx +;; mingw-dll) clean # Explicitly specify the compiler with a triple prefix. The CI