diff options
author | Anders Carlsson <andersca@mac.com> | 2010-02-06 23:59:05 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-02-06 23:59:05 +0000 |
commit | a994ee4b197554282ae6b222c3284ccaa3a6484c (patch) | |
tree | 4b3233579ed31634d682068fd6d902bd3c49fa4a | |
parent | a508b7de6c5246ab04ed69d0ab4e9977ec1fb4d4 (diff) |
Make EmitStartEHSpec and EmitEndEHSpec return early when exceptions are disabled.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95509 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGException.cpp | 6 | ||||
-rw-r--r-- | test/CodeGenCXX/no-exceptions.cpp | 12 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp index a992b459d8..85db6bb973 100644 --- a/lib/CodeGen/CGException.cpp +++ b/lib/CodeGen/CGException.cpp @@ -317,6 +317,9 @@ void CodeGenFunction::EmitCXXThrowExpr(const CXXThrowExpr *E) { } void CodeGenFunction::EmitStartEHSpec(const Decl *D) { + if (!Exceptions) + return; + const FunctionDecl* FD = dyn_cast_or_null<FunctionDecl>(D); if (FD == 0) return; @@ -411,6 +414,9 @@ void CodeGenFunction::EmitStartEHSpec(const Decl *D) { } void CodeGenFunction::EmitEndEHSpec(const Decl *D) { + if (!Exceptions) + return; + const FunctionDecl* FD = dyn_cast_or_null<FunctionDecl>(D); if (FD == 0) return; diff --git a/test/CodeGenCXX/no-exceptions.cpp b/test/CodeGenCXX/no-exceptions.cpp new file mode 100644 index 0000000000..da672c43f8 --- /dev/null +++ b/test/CodeGenCXX/no-exceptions.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s + +void g(); + +// CHECK: define void @_Z1fv() nounwind +void f() throw (int) { + + // CHECK-NOT: invoke void @_Z1gv + g(); + // CHECK: call void @_Z1gv() + // CHECK: ret void +} |