Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libcxx] [test] Fix running tests with Clang-cl in Debug mode
When building in debug mode, the debug version of the MSVC CRT gets linked in. (This is the default in CMake in general. In the case of libcxx, we manually link the CRT though - and in debug mode, we pick the debug version of the CRT.) When building the tests, we need to use the same version of the CRT as was used for building the library. Additionally; the debug CRT defaults to pop up a dialog box when asserts fail, which blocks running tests. By including the set_windows_crt_report_mode.h helper header, we change the assert behaviour back to that of release mode - printing a message and exiting immediately. This was supported by the old libcxx test system, where support for it was added in 7e3ee09. When porting over to the newer test setup, this mechanism wasn't brought over (and the old test infrastructure was removed in a48f018). Thus: In debug mode, link against the debug versions of msvcrt and msvcprt, define _DEBUG (enabling CRT debug mode code patterns), and include the set_windows_crt_report_mode.h header. Based on a patch by Andrew Ng. Linking of the debug version of the CRT can also be done by using the new -fms-runtime-lib= Clang option. However that option was added in Clang 16, and libcxx only requires Clang 15 for now; therefore doing the CRT linking entirely manually for now (just as before). Additionally, adjust set_windows_crt_report_mode.h to avoid including the body of the file when building in C mode or in C++03 mode. This fixes the following two tests: libcxx/include_as_c.sh.cpp libcxx/selftest/dsl/dsl.sh.py The former test is built in C mode. The latter tries compiling things as C++03. Some of the vcruntime headers that we include break in C++03 mode when MS CRT debug mode is enabled. Differential Revision: https://reviews.llvm.org/D155554
- Loading branch information
Showing
6 changed files
with
56 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters