[cfe-commits] r95509 - in /cfe/trunk: lib/CodeGen/CGException.cpp test/CodeGenCXX/no-exceptions.cpp

Anders Carlsson andersca at mac.com
Sat Feb 6 15:59:05 PST 2010


Author: andersca
Date: Sat Feb  6 17:59:05 2010
New Revision: 95509

URL: http://llvm.org/viewvc/llvm-project?rev=95509&view=rev
Log:
Make EmitStartEHSpec and EmitEndEHSpec return early when exceptions are disabled.

Added:
    cfe/trunk/test/CodeGenCXX/no-exceptions.cpp
Modified:
    cfe/trunk/lib/CodeGen/CGException.cpp

Modified: cfe/trunk/lib/CodeGen/CGException.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=95509&r1=95508&r2=95509&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGException.cpp Sat Feb  6 17:59:05 2010
@@ -317,6 +317,9 @@
 }
 
 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::EmitEndEHSpec(const Decl *D) {
+  if (!Exceptions)
+    return;
+  
   const FunctionDecl* FD = dyn_cast_or_null<FunctionDecl>(D);
   if (FD == 0)
     return;

Added: cfe/trunk/test/CodeGenCXX/no-exceptions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/no-exceptions.cpp?rev=95509&view=auto

==============================================================================
--- cfe/trunk/test/CodeGenCXX/no-exceptions.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/no-exceptions.cpp Sat Feb  6 17:59:05 2010
@@ -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
+}





More information about the cfe-commits mailing list