Emit an error when attempting to generate IR for SEH __try

Currently we silently omit the code in the try and finally bodies, which
is pretty bad.  This way we fail loudly.

llvm-svn: 190809
This commit is contained in:
Reid Kleckner 2013-09-16 21:46:30 +00:00
parent 66ea0363e4
commit 543a16c06b
4 changed files with 25 additions and 1 deletions

View File

@ -1697,3 +1697,7 @@ llvm::BasicBlock *CodeGenFunction::getEHResumeBlock(bool isCleanup) {
return EHResumeBlock;
}
void CodeGenFunction::EmitSEHTryStmt(const SEHTryStmt &S) {
CGM.ErrorUnsupported(&S, "SEH __try");
}

View File

@ -168,8 +168,9 @@ void CodeGenFunction::EmitStmt(const Stmt *S) {
break;
case Stmt::CXXForRangeStmtClass:
EmitCXXForRangeStmt(cast<CXXForRangeStmt>(*S));
break;
case Stmt::SEHTryStmtClass:
// FIXME Not yet implemented
EmitSEHTryStmt(cast<SEHTryStmt>(*S));
break;
}
}

View File

@ -1838,6 +1838,7 @@ public:
void ExitCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock = false);
void EmitCXXTryStmt(const CXXTryStmt &S);
void EmitSEHTryStmt(const SEHTryStmt &S);
void EmitCXXForRangeStmt(const CXXForRangeStmt &S);
llvm::Function *EmitCapturedStmt(const CapturedStmt &S, CapturedRegionKind K);

View File

@ -0,0 +1,18 @@
// RUN: not %clang_cc1 -triple i686-pc-win32 -fexceptions -fms-extensions -emit-llvm -o - %s 2>&1 | FileCheck %s
// This is a codegen test because we only emit the diagnostic when we start
// generating code.
int SaveDiv(int numerator, int denominator, int *res) {
int myres = 0;
__try {
myres = numerator / denominator;
} __except (1) {
return 0;
}
*res = myres;
return 1;
}
// CHECK-NOT error
// CHECK: error: cannot compile this SEH __try yet
// CHECK-NOT error