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