diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-05-05 21:12:12 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-05-05 21:12:12 +0000 |
commit | a82b5d840f065454e3cc30966c5147ca5729b2f6 (patch) | |
tree | 0376a257269dee37c5618a94c44f080eeb83b1f9 /clang/lib/CodeGen | |
parent | 6764c00687c534dbd73729f622bbd177e531958f (diff) | |
download | bcm5719-llvm-a82b5d840f065454e3cc30966c5147ca5729b2f6.tar.gz bcm5719-llvm-a82b5d840f065454e3cc30966c5147ca5729b2f6.zip |
MS ABI: Emit an error during IRgen on C++ exception handling
Currently, users get error messages about RTTI descriptor mangling with
no useful source location. This addresses that.
Another approach would be to disable C++ exceptions by default in the
driver when using the Microsoft C++ ABI. However, this makes it
impossible to parse system headers that use exception handling
constructs. By delaying the error to IRgen, we can figure out if we
actually need to emit code for this construct. Additionally, users who
are only interested in building refactoring tools on Windows still get a
correct AST without having to add flags. Finally, this is consistent
with what we do for SEH.
llvm-svn: 207999
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index ca31717403e..bd545234938 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -418,6 +418,11 @@ llvm::Value *CodeGenFunction::getSelectorFromSlot() { void CodeGenFunction::EmitCXXThrowExpr(const CXXThrowExpr *E, bool KeepInsertionPoint) { + if (CGM.getTarget().getTriple().isWindowsMSVCEnvironment()) { + ErrorUnsupported(E, "throw expression"); + return; + } + if (!E->getSubExpr()) { EmitNoreturnRuntimeCallOrInvoke(getReThrowFn(CGM), ArrayRef<llvm::Value*>()); @@ -574,6 +579,11 @@ void CodeGenFunction::EmitEndEHSpec(const Decl *D) { } void CodeGenFunction::EmitCXXTryStmt(const CXXTryStmt &S) { + if (CGM.getTarget().getTriple().isWindowsMSVCEnvironment()) { + ErrorUnsupported(&S, "try statement"); + return; + } + EnterCXXTryStmt(S); EmitStmt(S.getTryBlock()); ExitCXXTryStmt(S); |