From 14de9aa3dfac95feeffbff6af96bb7d5ec27b6a7 Mon Sep 17 00:00:00 2001
From: Chris Eibl <138194463+chris-eibl@users.noreply.github.com>
Date: Sat, 19 Sep 2026 13:20:13 +0200
Subject: [PATCH] Use compiler option ``-Og`` in case of clang-cl
debug builds on Windows to reduce stack usage.
---
.../next/Windows/2026-09-19-13-18-48.gh-issue-157789.o6-rmo.rst | 2 ++
PCbuild/pyproject-clangcl.props | 1 +
2 files changed, 3 insertions(+)
create mode 100644 Misc/NEWS.d/next/Windows/2026-09-19-13-18-48.gh-issue-157789.o6-rmo.rst
diff --git a/Misc/NEWS.d/next/Windows/2026-09-19-13-18-48.gh-issue-157789.o6-rmo.rst b/Misc/NEWS.d/next/Windows/2026-09-19-13-18-48.gh-issue-157789.o6-rmo.rst
new file mode 100644
index 00000000000000..f7f998b9eced36
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2026-09-19-13-18-48.gh-issue-157789.o6-rmo.rst
@@ -0,0 +1,2 @@
+Use compiler option ``-Og`` in case of clang-cl debug builds on Windows to
+reduce stack usage. Patch by Chris Eibl.
diff --git a/PCbuild/pyproject-clangcl.props b/PCbuild/pyproject-clangcl.props
index 70a81ca7da306c..14843f18823ca9 100644
--- a/PCbuild/pyproject-clangcl.props
+++ b/PCbuild/pyproject-clangcl.props
@@ -50,6 +50,7 @@
-m32 %(AdditionalOptions)
-m64 %(AdditionalOptions)
-flto=thin %(AdditionalOptions)
+ %(AdditionalOptions) -Xclang -Og
-fprofile-instr-generate=$(_CLANG_PROFILE_PATH)$(TargetName)_%m.profraw %(AdditionalOptions)
-fprofile-instr-use=$(OutDir)instrumented\profdata.profdata -Wno-profile-instr-unprofiled %(AdditionalOptions)