Skip to content

Commit 7fc50e9

Browse files
authored
clang: Fix parsing of seh exception model (#146643)
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.
1 parent 734d31a commit 7fc50e9

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3682,12 +3682,13 @@ static StringRef GetInputKindName(InputKind IK) {
36823682
static StringRef getExceptionHandlingName(unsigned EHK) {
36833683
switch (static_cast<LangOptions::ExceptionHandlingKind>(EHK)) {
36843684
case LangOptions::ExceptionHandlingKind::None:
3685-
default:
36863685
return "none";
3687-
case LangOptions::ExceptionHandlingKind::SjLj:
3688-
return "sjlj";
36893686
case LangOptions::ExceptionHandlingKind::DwarfCFI:
36903687
return "dwarf";
3688+
case LangOptions::ExceptionHandlingKind::SjLj:
3689+
return "sjlj";
3690+
case LangOptions::ExceptionHandlingKind::WinEH:
3691+
return "seh";
36913692
case LangOptions::ExceptionHandlingKind::Wasm:
36923693
return "wasm";
36933694
}
@@ -4028,7 +4029,7 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
40284029
A->getValue())
40294030
.Case("dwarf", LangOptions::ExceptionHandlingKind::DwarfCFI)
40304031
.Case("sjlj", LangOptions::ExceptionHandlingKind::SjLj)
4031-
.Case("wineh", LangOptions::ExceptionHandlingKind::WinEH)
4032+
.Case("seh", LangOptions::ExceptionHandlingKind::WinEH)
40324033
.Case("wasm", LangOptions::ExceptionHandlingKind::Wasm)
40334034
.Case("none", LangOptions::ExceptionHandlingKind::None)
40344035
.Default(std::nullopt);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: %clang -target x86_64-windows-gnu -x c++-module -std=gnu++23 -c -o /dev/null -Xclang -disable-llvm-passes %s
2+
3+
// Make sure the command succeeds and doesn't break on the -exception-model flag in cc1.
4+
export module empty;

0 commit comments

Comments
 (0)