-
Notifications
You must be signed in to change notification settings - Fork 14.4k
clang: Fix parsing of seh exception model #146643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clang: Fix parsing of seh exception model #146643
Conversation
Fixes regression reported #146342 (comment) 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.
@llvm/pr-subscribers-clang-modules @llvm/pr-subscribers-clang-driver Author: Matt Arsenault (arsenm) ChangesFixes regression reported #146342 (comment) The test could probably be better. I'm not sure what special is happening with the module Full diff: https://github.com/llvm/llvm-project/pull/146643.diff 2 Files Affected:
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;
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks good to me! I'd still wait a little bit in case a Clang maintainer has an opinion on it, but it seems to fix the issue for me.
I'll go ahead and land this now to unbreak my builds. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/18970 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/22666 Here is the relevant piece of the build log for the reference
|
I pushed a fix to add |
Fixes regression reported #146342 (comment)
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.