[Lldb-commits] [lldb] [LLDB] Compile API tests with exceptions enabled on Windows (PR #148691)

via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 14 11:05:23 PDT 2025


https://github.com/Nerixyz created https://github.com/llvm/llvm-project/pull/148691

>From #148554 - compile tests with exceptions on Windows (`-fno-exceptions` was added 11 years ago in c7826524acda6a9c8816261d5c48b94dc92935ed). The variant test uses `try {} catch {}` to create variants that are valueless by exception. On other platforms, exceptions are enabled as well.

I have no clue why compiling with exceptions will optimize out `a_long_guy` in the changed test (even with `-O0`). Taking the address of that value will ensure it's kept.

>From 56d2a0fe8f62084c29a2e1459cbb3529bdb52d48 Mon Sep 17 00:00:00 2001
From: Nerixyz <nerixdev at outlook.de>
Date: Mon, 14 Jul 2025 20:00:08 +0200
Subject: [PATCH] [LLDB] Compile API tests with exceptions enabled on Windows

---
 lldb/packages/Python/lldbsuite/test/make/Makefile.rules       | 4 ----
 .../data-formatter/data-formatter-advanced/main.cpp           | 1 +
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 58833e1b0cc78..8521ca508a479 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -344,10 +344,6 @@ endif
 #----------------------------------------------------------------------
 ifeq "$(OS)" "Windows_NT"
 	ifeq ($(CC_TYPE), clang)
-		# Clang for Windows doesn't support C++ Exceptions
-		CXXFLAGS += -fno-exceptions
-		CXXFLAGS += -D_HAS_EXCEPTIONS=0
-
 		# MSVC 2015 or higher is required, which depends on c++14, so
 		# append these values unconditionally.
 		CXXFLAGS += -fms-compatibility-version=19.0
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/main.cpp b/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/main.cpp
index 9d12ca30f984c..32f5f2ce436fe 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/main.cpp
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-advanced/main.cpp
@@ -165,6 +165,7 @@ int main (int argc, const char * argv[])
     Simple a_simple_object(3,0.14,'E');
     
     VeryLong a_long_guy;
+    auto *unused = &a_long_guy; // ensure a_long_guy isn't optimized out
 
     std::string some_string = "012345678901234567890123456789"
                               "012345678901234567890123456789"



More information about the lldb-commits mailing list