https://github.com/arsenm created 
https://github.com/llvm/llvm-project/pull/146643

Fixes regression reported 
https://github.com/llvm/llvm-project/pull/146342#issuecomment-3026600152

The test could probably be better. I'm not sure what special is happening with 
the module
compile, but I can't seem to reproduce this with just a plain -cc1 run.

>From c3e1cec8047f79300d6266b694ba069829c1a3d9 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <matthew.arsena...@amd.com>
Date: Wed, 2 Jul 2025 15:58:03 +0900
Subject: [PATCH] clang: Fix parsing of seh exception model

Fixes regression reported 
https://github.com/llvm/llvm-project/pull/146342#issuecomment-3026600152

The test could probably be better. I'm not sure what special is happening with 
the module
compile, but I can't seem to reproduce this with just a plain -cc1 run.
---
 clang/lib/Frontend/CompilerInvocation.cpp | 9 +++++----
 clang/test/Modules/mingw-exceptions.cppm  | 4 ++++
 2 files changed, 9 insertions(+), 4 deletions(-)
 create mode 100644 clang/test/Modules/mingw-exceptions.cppm

diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index d8916a6b15f58..0a9e3649b386b 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3682,12 +3682,13 @@ static StringRef GetInputKindName(InputKind IK) {
 static StringRef getExceptionHandlingName(unsigned EHK) {
   switch (static_cast<LangOptions::ExceptionHandlingKind>(EHK)) {
   case LangOptions::ExceptionHandlingKind::None:
-  default:
     return "none";
-  case LangOptions::ExceptionHandlingKind::SjLj:
-    return "sjlj";
   case LangOptions::ExceptionHandlingKind::DwarfCFI:
     return "dwarf";
+  case LangOptions::ExceptionHandlingKind::SjLj:
+    return "sjlj";
+  case LangOptions::ExceptionHandlingKind::WinEH:
+    return "seh";
   case LangOptions::ExceptionHandlingKind::Wasm:
     return "wasm";
   }
@@ -4028,7 +4029,7 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, 
ArgList &Args,
               A->getValue())
               .Case("dwarf", LangOptions::ExceptionHandlingKind::DwarfCFI)
               .Case("sjlj", LangOptions::ExceptionHandlingKind::SjLj)
-              .Case("wineh", LangOptions::ExceptionHandlingKind::WinEH)
+              .Case("seh", LangOptions::ExceptionHandlingKind::WinEH)
               .Case("wasm", LangOptions::ExceptionHandlingKind::Wasm)
               .Case("none", LangOptions::ExceptionHandlingKind::None)
               .Default(std::nullopt);
diff --git a/clang/test/Modules/mingw-exceptions.cppm 
b/clang/test/Modules/mingw-exceptions.cppm
new file mode 100644
index 0000000000000..e6f383f07200f
--- /dev/null
+++ b/clang/test/Modules/mingw-exceptions.cppm
@@ -0,0 +1,4 @@
+// RUN: %clang -target x86_64-windows-gnu -x c++-module -std=gnu++23 -c -o 
/dev/null -Xclang -disable-llvm-passes %s
+
+// Make sure the command succeeds and doesn't break on the -exception-model 
flag in cc1.
+export module empty;

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to