From 084f3b2d225e37133cf5c9977fd629d0acad3006 Mon Sep 17 00:00:00 2001 From: ykiko Date: Tue, 31 Mar 2026 21:18:27 +0800 Subject: [PATCH] docs(cmake): restore ASan workaround comments (#380) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Restore comment explaining clang-cl manual ASan runtime linking workaround - Restore comment explaining OPT:NOICF for ASan ODR false positives on Windows These were accidentally removed in #379. 🤖 Generated with [Claude Code](https://claude.com/claude-code) ## Summary by CodeRabbit * **Chores** * Improved internal build configuration for Debug builds on Windows to enhance development and testing infrastructure with better error detection and optimization settings. Co-authored-by: Claude Opus 4.6 --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e0955720..609c2b22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,8 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_compile_options(-fsanitize=address) if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC") + # clang-cl (MSVC frontend): manually link ASan runtime since clang-cl + # doesn't handle -fsanitize=address linking automatically. execute_process( COMMAND ${CMAKE_CXX_COMPILER} --print-resource-dir OUTPUT_VARIABLE CLANG_RESOURCE_DIR @@ -87,6 +89,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") endif() if(WIN32) + # Disable Identical COMDAT Folding in Debug to avoid ASan ODR false positives. string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,/OPT:NOICF") string(APPEND CMAKE_SHARED_LINKER_FLAGS " -Wl,/OPT:NOICF") endif()