DXC: enable asserts in non-debug builds

This change enables asserts in non-debug builds of DXC by undefining
NDEBUG, and defining LLVM_ASSERTIONS_NO_STRINGS, and
LLVM_ASSERTIONS_TRAP.

We do this to reduce the DXC security bug rate by preferring assertions.
We make sure assertions always trap, which makes the GPU process crash.

The binary size of dxcompiler.dll increases by 3.5 MiB. We drop
assertion strings, which would otherwise add another 3 MiB. The Chrome
installer payload increases by 738 KiB. This increase was approved by
chrome-binary-size@, see
go/webgpu-dxc-asserts-in-non-debug-increasing-installer-size.

Change-Id: I44d0ca34de7085e5d88df6079892fc2f5bbf867f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/199734
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f17d6d7..c35a7bb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -152,7 +152,7 @@
 option(DAWN_USE_GLFW "Enable compilation of the GLFW windowing utils" ${DAWN_SUPPORTS_GLFW_FOR_WINDOWING})
 option(DAWN_USE_WINDOWS_UI "Enable support for Windows UI surface" ${USE_WINDOWS_UI})
 option(DAWN_USE_BUILT_DXC "Enable building and using DXC by the D3D12 backend" OFF)
-option(DAWN_DXC_DISABLE_ASSERTS_DEBUG "Disable asserts in DXC in debug builds" OFF)
+option(DAWN_DXC_ENABLE_ASSERTS_IN_NDEBUG "Enable DXC asserts in non-debug builds" ON)
 option(DAWN_TARGET_MACOS "Manually link Apple core frameworks" ${TARGET_MACOS})
 
 option(DAWN_BUILD_SAMPLES "Enables building Dawn's samples" ${BUILD_SAMPLES})
@@ -300,7 +300,7 @@
 message(STATUS "Dawn build GLFW support: ${DAWN_USE_GLFW}")
 message(STATUS "Dawn build Windows UI support: ${DAWN_USE_WINDOWS_UI}")
 message(STATUS "Dawn build and use DXC: ${DAWN_USE_BUILT_DXC}")
-message(STATUS "Dawn disable DXC asserts in debug builds: ${DAWN_DXC_DISABLE_ASSERTS_DEBUG}")
+message(STATUS "Dawn enable DXC asserts in non-debug builds: ${DAWN_DXC_ENABLE_ASSERTS_IN_NDEBUG}")
 
 message(STATUS "Dawn build samples: ${DAWN_BUILD_SAMPLES}")
 message(STATUS "Dawn build Node bindings: ${DAWN_BUILD_NODE_BINDINGS}")