1*f4a2713aSLionel Sambuc // RUN: %clangxx -target x86_64-unknown-unknown -g %s -emit-llvm -S -o - | FileCheck %s 2*f4a2713aSLionel Sambuc // PR14471 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc enum X { 5*f4a2713aSLionel Sambuc Y 6*f4a2713aSLionel Sambuc }; 7*f4a2713aSLionel Sambuc class C 8*f4a2713aSLionel Sambuc { 9*f4a2713aSLionel Sambuc static int a; 10*f4a2713aSLionel Sambuc const static bool const_a = true; 11*f4a2713aSLionel Sambuc protected: 12*f4a2713aSLionel Sambuc static int b; 13*f4a2713aSLionel Sambuc const static float const_b = 3.14; 14*f4a2713aSLionel Sambuc public: 15*f4a2713aSLionel Sambuc static int c; 16*f4a2713aSLionel Sambuc const static int const_c = 18; 17*f4a2713aSLionel Sambuc int d; 18*f4a2713aSLionel Sambuc static X x_a; 19*f4a2713aSLionel Sambuc }; 20*f4a2713aSLionel Sambuc 21*f4a2713aSLionel Sambuc int C::a = 4; 22*f4a2713aSLionel Sambuc int C::b = 2; 23*f4a2713aSLionel Sambuc int C::c = 1; 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambuc int main() 26*f4a2713aSLionel Sambuc { 27*f4a2713aSLionel Sambuc C instance_C; 28*f4a2713aSLionel Sambuc instance_C.d = 8; 29*f4a2713aSLionel Sambuc return C::c; 30*f4a2713aSLionel Sambuc } 31*f4a2713aSLionel Sambuc 32*f4a2713aSLionel Sambuc // The definition of C::a drives the emission of class C, which is 33*f4a2713aSLionel Sambuc // why the definition of "a" comes before the declarations while 34*f4a2713aSLionel Sambuc // "b" and "c" come after. 35*f4a2713aSLionel Sambuc 36*f4a2713aSLionel Sambuc // CHECK: metadata !"_ZTS1X"} ; [ DW_TAG_enumeration_type ] [X] 37*f4a2713aSLionel Sambuc // CHECK: metadata !"_ZTS1C"} ; [ DW_TAG_class_type ] [C] 38*f4a2713aSLionel Sambuc // CHECK: ![[DECL_A:[0-9]+]] = metadata {{.*}} [ DW_TAG_member ] [a] [line {{.*}}, size 0, align 0, offset 0] [private] [static] 39*f4a2713aSLionel Sambuc // CHECK: metadata !"const_a", {{.*}}, i1 true} ; [ DW_TAG_member ] [const_a] [line {{.*}}, size 0, align 0, offset 0] [private] [static] 40*f4a2713aSLionel Sambuc // CHECK: ![[DECL_B:[0-9]+]] {{.*}} metadata !"b", {{.*}} [ DW_TAG_member ] [b] [line {{.*}}, size 0, align 0, offset 0] [protected] [static] 41*f4a2713aSLionel Sambuc // CHECK: metadata !"const_b", {{.*}}, float 0x{{.*}}} ; [ DW_TAG_member ] [const_b] [line {{.*}}, size 0, align 0, offset 0] [protected] [static] 42*f4a2713aSLionel Sambuc // CHECK: ![[DECL_C:[0-9]+]] {{.*}} metadata !"c", {{.*}} [ DW_TAG_member ] [c] [line {{.*}}, size 0, align 0, offset 0] [static] 43*f4a2713aSLionel Sambuc // CHECK: metadata !"const_c", {{.*}} [ DW_TAG_member ] [const_c] [line {{.*}}, size 0, align 0, offset 0] [static] 44*f4a2713aSLionel Sambuc // CHECK: metadata !"x_a", {{.*}} [ DW_TAG_member ] [x_a] {{.*}} [static] 45*f4a2713aSLionel Sambuc // CHECK: metadata !"a", {{.*}} @_ZN1C1aE, metadata ![[DECL_A]]} ; [ DW_TAG_variable ] [a] {{.*}} [def] 46*f4a2713aSLionel Sambuc // CHECK: metadata !"b", {{.*}} @_ZN1C1bE, metadata ![[DECL_B]]} ; [ DW_TAG_variable ] [b] {{.*}} [def] 47*f4a2713aSLionel Sambuc // CHECK: metadata !"c", {{.*}} @_ZN1C1cE, metadata ![[DECL_C]]} ; [ DW_TAG_variable ] [c] {{.*}} [def] 48