diff options
author | Reid Kleckner <reid@kleckner.net> | 2013-09-16 21:46:30 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2013-09-16 21:46:30 +0000 |
commit | 543a16c06bde0ecf00ff432e49184c3ddc3c9e06 (patch) | |
tree | faae534c140f6c4ac3039579fb9c242adbe2b443 | |
parent | 66ea0363e4c41fcf82db5bee521b9fa077a66a8c (diff) | |
download | bcm5719-llvm-543a16c06bde0ecf00ff432e49184c3ddc3c9e06.tar.gz bcm5719-llvm-543a16c06bde0ecf00ff432e49184c3ddc3c9e06.zip |
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
-rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 1 | ||||
-rw-r--r-- | clang/test/CodeGen/exceptions-seh.c | 18 |
4 files changed, 25 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index 0c2cfc4c07b..1748621da34 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -1697,3 +1697,7 @@ llvm::BasicBlock *CodeGenFunction::getEHResumeBlock(bool isCleanup) { return EHResumeBlock; } + +void CodeGenFunction::EmitSEHTryStmt(const SEHTryStmt &S) { + CGM.ErrorUnsupported(&S, "SEH __try"); +} diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index e3095403f91..4492ea9a8f3 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -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; } } diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 20c0b82553c..5889d058606 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -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); diff --git a/clang/test/CodeGen/exceptions-seh.c b/clang/test/CodeGen/exceptions-seh.c new file mode 100644 index 00000000000..eadbe15cfff --- /dev/null +++ b/clang/test/CodeGen/exceptions-seh.c @@ -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 |