1850361f6SRafael Stahl // RUN: %clang_extdef_map %s -- | FileCheck --implicit-check-not "c:@y" --implicit-check-not "c:@z" %s 2e350b0a1SGabor Horvath 3e350b0a1SGabor Horvath int f(int) { 4e350b0a1SGabor Horvath return 0; 5e350b0a1SGabor Horvath } 6850361f6SRafael Stahl // CHECK-DAG: c:@F@f#I# 7e350b0a1SGabor Horvath 8850361f6SRafael Stahl extern const int x = 5; 9850361f6SRafael Stahl // CHECK-DAG: c:@x 10850361f6SRafael Stahl 11850361f6SRafael Stahl // Non-const variables should not be collected. 12850361f6SRafael Stahl int y = 5; 13850361f6SRafael Stahl 14850361f6SRafael Stahl // In C++, const implies internal linkage, so not collected. 15850361f6SRafael Stahl const int z = 5; 16850361f6SRafael Stahl 17850361f6SRafael Stahl struct S { 18850361f6SRafael Stahl int a; 19850361f6SRafael Stahl }; 20850361f6SRafael Stahl extern S const s = {.a = 2}; 21850361f6SRafael Stahl // CHECK-DAG: c:@s 22850361f6SRafael Stahl 23850361f6SRafael Stahl struct SF { 24850361f6SRafael Stahl const int a; 25850361f6SRafael Stahl }; 26850361f6SRafael Stahl SF sf = {.a = 2}; 27850361f6SRafael Stahl // CHECK-DAG: c:@sf 28850361f6SRafael Stahl 29850361f6SRafael Stahl struct SStatic { 30850361f6SRafael Stahl static const int a = 4; 31850361f6SRafael Stahl }; 32850361f6SRafael Stahl const int SStatic::a; 33850361f6SRafael Stahl // CHECK-DAG: c:@S@SStatic@a 34850361f6SRafael Stahl 35850361f6SRafael Stahl extern int const arr[5] = { 0, 1 }; 36850361f6SRafael Stahl // CHECK-DAG: c:@arr 37850361f6SRafael Stahl 38850361f6SRafael Stahl union U { 39850361f6SRafael Stahl const int a; 40850361f6SRafael Stahl const unsigned int b; 41850361f6SRafael Stahl }; 42850361f6SRafael Stahl U u = {.a = 6}; 43850361f6SRafael Stahl // CHECK-DAG: c:@u 44*4e79097dSBalazs Keri 45*4e79097dSBalazs Keri // No USR can be generated for this. 46*4e79097dSBalazs Keri // Check for no crash in this case. 47*4e79097dSBalazs Keri static union { 48*4e79097dSBalazs Keri float uf; 49*4e79097dSBalazs Keri const int ui; 50*4e79097dSBalazs Keri }; 51