When an exception needs to be freed by calling __cxa_exception_free, make sure to stash away the exception pointer somewhere.
This fixes an "Instruction does not dominate all uses!" verification error when compiling TableGen.
llvm-svn: 91084
diff --git a/clang/test/CodeGenCXX/exceptions.cpp b/clang/test/CodeGenCXX/exceptions.cpp
new file mode 100644
index 0000000..396ff44
--- /dev/null
+++ b/clang/test/CodeGenCXX/exceptions.cpp
@@ -0,0 +1,18 @@
+// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -fexceptions
+
+struct allocator {
+ allocator();
+ allocator(const allocator&);
+ ~allocator();
+};
+
+void f();
+void g(bool b, bool c) {
+ if (b) {
+ if (!c)
+ throw allocator();
+
+ return;
+ }
+ f();
+}