From 0a79d0e495964f18eae9000cf3d3637930f8e9b0 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 8 Jul 2015 23:57:03 +0000 Subject: [PATCH] Disable 32-bit SEH, again Move the diagnostic back to codegen so that we can compile ATL on the self-host bot. We don't actually end up emitting code for the __try, so the diagnostic won't be hit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241761 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/TargetInfo.h | 3 +-- lib/CodeGen/CGException.cpp | 4 ++++ lib/Sema/SemaStmt.cpp | 4 ---- test/CodeGen/exceptions-seh-finally.c | 3 ++- test/CodeGen/exceptions-seh.c | 5 +++-- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index fed69a8281..2c32e8c22b 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -812,8 +812,7 @@ public: /// \brief Whether the target supports SEH __try. bool isSEHTrySupported() const { return getTriple().isOSWindows() && - (getTriple().getArch() == llvm::Triple::x86 || - getTriple().getArch() == llvm::Triple::x86_64); + getTriple().getArch() == llvm::Triple::x86_64; } /// \brief Return true if {|} are normal characters in the asm string. diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp index 987ffc14a4..c7e3ed5c34 100644 --- a/lib/CodeGen/CGException.cpp +++ b/lib/CodeGen/CGException.cpp @@ -1280,6 +1280,10 @@ llvm::BasicBlock *CodeGenFunction::getEHResumeBlock(bool isCleanup) { } void CodeGenFunction::EmitSEHTryStmt(const SEHTryStmt &S) { + // Reject __try on unsupported targets. + if (!getContext().getTargetInfo().isSEHTrySupported()) + ErrorUnsupported(&S, "SEH '__try' on this target"); + EnterSEHTryStmt(S); { JumpDest TryExit = getJumpDestInCurrentScope("__try.__leave"); diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index c4f6fd8df1..3ffedf28ad 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -3650,10 +3650,6 @@ StmtResult Sema::ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, else Diag(TryLoc, diag::err_seh_try_outside_functions); - // Reject __try on unsupported targets. - if (!Context.getTargetInfo().isSEHTrySupported()) - Diag(TryLoc, diag::err_seh_try_unsupported); - return SEHTryStmt::Create(Context, IsCXXTry, TryLoc, TryBlock, Handler); } diff --git a/test/CodeGen/exceptions-seh-finally.c b/test/CodeGen/exceptions-seh-finally.c index 772e28306b..513a1f3c89 100644 --- a/test/CodeGen/exceptions-seh-finally.c +++ b/test/CodeGen/exceptions-seh-finally.c @@ -1,5 +1,6 @@ // RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s +// FIXME: Re-enable 32-bit SEH. +// RUNX: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s void abort(void) __attribute__((noreturn)); void might_crash(void); diff --git a/test/CodeGen/exceptions-seh.c b/test/CodeGen/exceptions-seh.c index 9707a9a31b..702125b07a 100644 --- a/test/CodeGen/exceptions-seh.c +++ b/test/CodeGen/exceptions-seh.c @@ -1,7 +1,8 @@ // RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fms-extensions -emit-llvm -o - \ // RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=X64 -// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - \ -// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=X86 +// FIXME: Re-enable 32-bit SEH. +// RUNX: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - \ +// RUNX: | FileCheck %s --check-prefix=CHECK --check-prefix=X86 void try_body(int numerator, int denominator, int *myres) { *myres = numerator / denominator; -- 2.50.1