tint: Bump stack size for MSVC + debug build

Bug: tint:1749
Change-Id: Ic7a87a769ade9c459914ac745b449b4383812753
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108923
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: James Price <jrprice@google.com>
diff --git a/src/tint/CMakeLists.txt b/src/tint/CMakeLists.txt
index ca4456f..1d39243 100644
--- a/src/tint/CMakeLists.txt
+++ b/src/tint/CMakeLists.txt
@@ -752,6 +752,7 @@
   endif()
 endif()
 
+
 ################################################################################
 # Tests
 ################################################################################
@@ -1351,7 +1352,16 @@
   add_executable(tint_unittests ${TINT_TEST_SRCS})
   set_target_properties(${target} PROPERTIES FOLDER "Tests")
 
-  if(NOT MSVC)
+  if(MSVC)
+    # TODO(crbug.com/tint/1749): MSVC debug builds can suffer from stack
+    # overflows when resolving deeply nested expression chains or statements.
+    # Production builds neither use MSVC nor debug, so just bump the stack size
+    # for this build combination.
+    string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type)
+    if ((NOT ${build_type} STREQUAL "RELEASE") AND (NOT ${build_type} STREQUAL "RELWITHDEBINFO"))
+      target_link_options(tint_unittests PRIVATE "/STACK 2097152") # 2MB, default is 1MB
+    endif()
+  else()
     target_compile_options(tint_unittests PRIVATE
       -Wno-global-constructors
       -Wno-weak-vtables