https://github.com/jansvoboda11 updated 
https://github.com/llvm/llvm-project/pull/190615

>From 3b34e5435c531eda5e3391fec1730cff02127d32 Mon Sep 17 00:00:00 2001
From: Jan Svoboda <[email protected]>
Date: Mon, 6 Apr 2026 08:13:11 -0700
Subject: [PATCH 1/9] [clang] Avoid sandbox violation in Windows signal handler

---
 clang/test/SemaCXX/windows_sandbox_violtion.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 clang/test/SemaCXX/windows_sandbox_violtion.cpp

diff --git a/clang/test/SemaCXX/windows_sandbox_violtion.cpp 
b/clang/test/SemaCXX/windows_sandbox_violtion.cpp
new file mode 100644
index 0000000000000..60daa99e5a3a3
--- /dev/null
+++ b/clang/test/SemaCXX/windows_sandbox_violtion.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang -std=c++17 -fsyntax-only %s
+
+template <class... Ts>
+auto f{[] (auto... a0) {
+  return [=] (Ts... a1) {
+    (..., [a0Cap{a0}, a1] { return a0Cap + a1; });
+  };
+}};
+
+auto g{f<int>};

>From 0413646176ba924ecf9e9ccf7b1fbd4bfbaff0e3 Mon Sep 17 00:00:00 2001
From: Jan Svoboda <[email protected]>
Date: Mon, 6 Apr 2026 08:46:19 -0700
Subject: [PATCH 2/9] Add driver mode

---
 clang/test/SemaCXX/windows_sandbox_violtion.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/SemaCXX/windows_sandbox_violtion.cpp 
b/clang/test/SemaCXX/windows_sandbox_violtion.cpp
index 60daa99e5a3a3..a69943cb2ed38 100644
--- a/clang/test/SemaCXX/windows_sandbox_violtion.cpp
+++ b/clang/test/SemaCXX/windows_sandbox_violtion.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang -std=c++17 -fsyntax-only %s
+// RUN: %clang --driver-mode=cl -std=c++17 -fsyntax-only %s
 
 template <class... Ts>
 auto f{[] (auto... a0) {

>From 16821c33a2ee5cd26279ae8859b1bb6b0f91dbe4 Mon Sep 17 00:00:00 2001
From: Jan Svoboda <[email protected]>
Date: Mon, 6 Apr 2026 09:39:40 -0700
Subject: [PATCH 3/9] Add more flags?

---
 clang/test/SemaCXX/windows_sandbox_violtion.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/test/SemaCXX/windows_sandbox_violtion.cpp 
b/clang/test/SemaCXX/windows_sandbox_violtion.cpp
index a69943cb2ed38..85493bfe57a30 100644
--- a/clang/test/SemaCXX/windows_sandbox_violtion.cpp
+++ b/clang/test/SemaCXX/windows_sandbox_violtion.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang --driver-mode=cl -std=c++17 -fsyntax-only %s
+// RUN: rm -rf %t && mkdir %t
+// RUN: %clang --driver-mode=cl -std=c++17 -c %s -o %t/a.o 
-fdiagnostics-format msvc -fdebug-compilation-dir %t/debug
 
 template <class... Ts>
 auto f{[] (auto... a0) {

>From 941ddebd2ab2ebd50f489ebaf88de239729d0de6 Mon Sep 17 00:00:00 2001
From: Jan Svoboda <[email protected]>
Date: Mon, 6 Apr 2026 09:57:09 -0700
Subject: [PATCH 4/9] LLVM_ENABLE_CRASH_DUMPS

---
 llvm/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index da012596cca93..310486ae6f333 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -623,7 +623,7 @@ if(LLVM_ENABLE_CRASH_OVERRIDES)
   set(ENABLE_CRASH_OVERRIDES 1)
 endif()
 
-option(LLVM_ENABLE_CRASH_DUMPS "Turn on memory dumps on crashes. Currently 
only implemented on Windows." OFF)
+option(LLVM_ENABLE_CRASH_DUMPS "Turn on memory dumps on crashes. Currently 
only implemented on Windows." ON)
 
 set(LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING "DISABLED" CACHE STRING
   "Enhance Debugify's line number coverage tracking; enabling this is 
ABI-breaking. Can be DISABLED, COVERAGE, or COVERAGE_AND_ORIGIN.")

>From b28ab6ef3028d534cec5555f80f610c83384c945 Mon Sep 17 00:00:00 2001
From: Jan Svoboda <[email protected]>
Date: Mon, 6 Apr 2026 10:25:42 -0700
Subject: [PATCH 5/9] Fix diagnostic format arg spelling

---
 clang/test/SemaCXX/windows_sandbox_violtion.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/SemaCXX/windows_sandbox_violtion.cpp 
b/clang/test/SemaCXX/windows_sandbox_violtion.cpp
index 85493bfe57a30..f8d474cab398a 100644
--- a/clang/test/SemaCXX/windows_sandbox_violtion.cpp
+++ b/clang/test/SemaCXX/windows_sandbox_violtion.cpp
@@ -1,5 +1,5 @@
 // RUN: rm -rf %t && mkdir %t
-// RUN: %clang --driver-mode=cl -std=c++17 -c %s -o %t/a.o 
-fdiagnostics-format msvc -fdebug-compilation-dir %t/debug
+// RUN: %clang --driver-mode=cl -std=c++17 -c %s -o %t/a.o 
-fdiagnostics-format=msvc -fdebug-compilation-dir %t/debug
 
 template <class... Ts>
 auto f{[] (auto... a0) {

>From c3ffc7dad1fd7608d29d70609e4f2d58fd48f568 Mon Sep 17 00:00:00 2001
From: Jan Svoboda <[email protected]>
Date: Mon, 6 Apr 2026 11:25:01 -0700
Subject: [PATCH 6/9] Pass -fcrash-diagnostics-dir=

---
 clang/test/SemaCXX/windows_sandbox_violtion.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/SemaCXX/windows_sandbox_violtion.cpp 
b/clang/test/SemaCXX/windows_sandbox_violtion.cpp
index f8d474cab398a..a7d29c54d7703 100644
--- a/clang/test/SemaCXX/windows_sandbox_violtion.cpp
+++ b/clang/test/SemaCXX/windows_sandbox_violtion.cpp
@@ -1,5 +1,5 @@
 // RUN: rm -rf %t && mkdir %t
-// RUN: %clang --driver-mode=cl -std=c++17 -c %s -o %t/a.o 
-fdiagnostics-format=msvc -fdebug-compilation-dir %t/debug
+// RUN: %clang --driver-mode=cl -std=c++17 -c %s -o %t/a.o 
-fdiagnostics-format=msvc -fdebug-compilation-dir %t/debug 
-fcrash-diagnostics-dir=%t/crash
 
 template <class... Ts>
 auto f{[] (auto... a0) {

>From 341c7776c6d0074a145f243aa389d2a8f7e74979 Mon Sep 17 00:00:00 2001
From: Jan Svoboda <[email protected]>
Date: Tue, 7 Apr 2026 10:30:19 -0700
Subject: [PATCH 7/9] Force-enable sandbox, change test

---
 clang/test/SemaCXX/windows_sandbox_violtion.cpp | 3 +--
 llvm/CMakeLists.txt                             | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/clang/test/SemaCXX/windows_sandbox_violtion.cpp 
b/clang/test/SemaCXX/windows_sandbox_violtion.cpp
index a7d29c54d7703..42c6628b9214c 100644
--- a/clang/test/SemaCXX/windows_sandbox_violtion.cpp
+++ b/clang/test/SemaCXX/windows_sandbox_violtion.cpp
@@ -1,5 +1,4 @@
-// RUN: rm -rf %t && mkdir %t
-// RUN: %clang --driver-mode=cl -std=c++17 -c %s -o %t/a.o 
-fdiagnostics-format=msvc -fdebug-compilation-dir %t/debug 
-fcrash-diagnostics-dir=%t/crash
+// RUN: %clang_cl %s -std:c++20
 
 template <class... Ts>
 auto f{[] (auto... a0) {
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 310486ae6f333..1db29a27de98d 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -745,7 +745,7 @@ else()
   option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
 endif()
 
-option(LLVM_ENABLE_IO_SANDBOX "Enable IO sandboxing in supported tools" 
${LLVM_ENABLE_ASSERTIONS})
+option(LLVM_ENABLE_IO_SANDBOX "Enable IO sandboxing in supported tools" ON)
 option(LLVM_ENABLE_EXPENSIVE_CHECKS "Enable expensive checks" OFF)
 
 set(LLVM_ABI_BREAKING_CHECKS "WITH_ASSERTS" CACHE STRING

>From 1ad5d418daf564396c9425e125dad5bdf802b6f1 Mon Sep 17 00:00:00 2001
From: Jan Svoboda <[email protected]>
Date: Tue, 7 Apr 2026 11:01:43 -0700
Subject: [PATCH 8/9] Bypass sandbox

---
 llvm/lib/Support/Windows/Signals.inc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/llvm/lib/Support/Windows/Signals.inc 
b/llvm/lib/Support/Windows/Signals.inc
index 7e6799befb983..c3d35c7f77734 100644
--- a/llvm/lib/Support/Windows/Signals.inc
+++ b/llvm/lib/Support/Windows/Signals.inc
@@ -21,6 +21,7 @@
 #include <stdio.h>
 
 #include "llvm/Support/Format.h"
+#include "llvm/Support/IOSandbox.h"
 #include "llvm/Support/raw_ostream.h"
 
 // The Windows.h header must be after LLVM and standard headers.
@@ -798,6 +799,9 @@ void sys::CleanupOnSignal(uintptr_t Context) {
 }
 
 static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
+  // Let's not interfere with stack trace symbolication and friends.
+  auto BypassSandbox = sandbox::scopedDisable();
+
   Cleanup(true);
 
   // Write out the exception code.
@@ -833,6 +837,9 @@ static LONG WINAPI 
LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
 }
 
 static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType) {
+  // Let's not interfere with stack trace symbolication and friends.
+  auto BypassSandbox = sandbox::scopedDisable();
+
   // We are running in our very own thread, courtesy of Windows.
   EnterCriticalSection(&CriticalSection);
   // This function is only ever called when a CTRL-C or similar control signal

>From 9c09dc9730df5c05f50c1de69be849e4f06196f0 Mon Sep 17 00:00:00 2001
From: Jan Svoboda <[email protected]>
Date: Tue, 7 Apr 2026 11:15:50 -0700
Subject: [PATCH 9/9] Namespaces

---
 llvm/lib/Support/Windows/Signals.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Support/Windows/Signals.inc 
b/llvm/lib/Support/Windows/Signals.inc
index c3d35c7f77734..ec55af04c9c24 100644
--- a/llvm/lib/Support/Windows/Signals.inc
+++ b/llvm/lib/Support/Windows/Signals.inc
@@ -800,7 +800,7 @@ void sys::CleanupOnSignal(uintptr_t Context) {
 
 static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
   // Let's not interfere with stack trace symbolication and friends.
-  auto BypassSandbox = sandbox::scopedDisable();
+  auto BypassSandbox = sys::sandbox::scopedDisable();
 
   Cleanup(true);
 
@@ -838,7 +838,7 @@ static LONG WINAPI 
LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep) {
 
 static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType) {
   // Let's not interfere with stack trace symbolication and friends.
-  auto BypassSandbox = sandbox::scopedDisable();
+  auto BypassSandbox = sys::sandbox::scopedDisable();
 
   // We are running in our very own thread, courtesy of Windows.
   EnterCriticalSection(&CriticalSection);

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to