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