Anders Carlsson | abea951 | 2011-02-28 00:40:07 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fno-rtti -fcxx-exceptions -fexceptions %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s |
John McCall | 9dffe6f | 2010-04-30 01:15:21 +0000 | [diff] [blame] | 2 | |
Anders Carlsson | f502d93 | 2011-01-24 00:46:19 +0000 | [diff] [blame] | 3 | // CHECK: @_ZTIN5test11AE = linkonce_odr unnamed_addr constant |
| 4 | // CHECK: @_ZTIN5test11BE = linkonce_odr unnamed_addr constant |
| 5 | // CHECK: @_ZTIN5test11CE = linkonce_odr unnamed_addr constant |
| 6 | // CHECK: @_ZTIN5test11DE = linkonce_odr unnamed_addr constant |
| 7 | // CHECK: @_ZTIPN5test11DE = linkonce_odr unnamed_addr constant {{.*}} @_ZTIN5test11DE |
John McCall | 9dffe6f | 2010-04-30 01:15:21 +0000 | [diff] [blame] | 8 | |
| 9 | // PR6974: this shouldn't crash |
| 10 | namespace test0 { |
| 11 | class err {}; |
| 12 | |
| 13 | void f(void) { |
| 14 | try { |
| 15 | } catch (err &) { |
| 16 | } |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | namespace test1 { |
John McCall | cbfe502 | 2010-08-04 08:34:44 +0000 | [diff] [blame] | 21 | // These classes have key functions defined out-of-line. Under |
| 22 | // normal circumstances, we wouldn't generate RTTI for them; under |
| 23 | // -fno-rtti, we generate RTTI only when required by EH. But |
| 24 | // everything gets hidden visibility because we assume that all |
| 25 | // users are also compiled under -fno-rtti and therefore will be |
| 26 | // emitting RTTI regardless of key function. |
John McCall | 9dffe6f | 2010-04-30 01:15:21 +0000 | [diff] [blame] | 27 | class A { virtual void foo(); }; |
| 28 | class B { virtual void foo(); }; |
| 29 | class C { virtual void foo(); }; |
| 30 | class D { virtual void foo(); }; |
| 31 | |
| 32 | void opaque(); |
| 33 | |
| 34 | void test0() { |
| 35 | throw A(); |
| 36 | } |
| 37 | |
| 38 | void test1() throw(B) { |
| 39 | opaque(); |
| 40 | } |
| 41 | |
| 42 | void test2() { |
| 43 | try { |
| 44 | opaque(); |
| 45 | } catch (C&) {} |
| 46 | } |
| 47 | |
| 48 | void test3(D *ptr) { |
| 49 | throw ptr; |
| 50 | }; |
| 51 | } |