1850361f6SRafael Stahl // RUN: %clang_extdef_map %s -- | FileCheck --implicit-check-not "c:@y" --implicit-check-not "c:@z" %s 2*e6ff5539STobias Hieta // RUN: %clang -emit-ast %s -o %t.ast 3*e6ff5539STobias Hieta // RUN: %clang_extdef_map %t.ast -- | FileCheck --implicit-check-not "c:@y" --implicit-check-not "c:@z" %s 4e350b0a1SGabor Horvath f(int)5e350b0a1SGabor Horvathint f(int) { 6e350b0a1SGabor Horvath return 0; 7e350b0a1SGabor Horvath } 89f902542SElla Ma // CHECK-DAG: 9:c:@F@f#I# 9e350b0a1SGabor Horvath 10850361f6SRafael Stahl extern const int x = 5; 119f902542SElla Ma // CHECK-DAG: 4:c:@x 12850361f6SRafael Stahl 13850361f6SRafael Stahl // Non-const variables should not be collected. 14850361f6SRafael Stahl int y = 5; 15850361f6SRafael Stahl 16850361f6SRafael Stahl // In C++, const implies internal linkage, so not collected. 17850361f6SRafael Stahl const int z = 5; 18850361f6SRafael Stahl 19850361f6SRafael Stahl struct S { 20850361f6SRafael Stahl int a; 21850361f6SRafael Stahl }; 22850361f6SRafael Stahl extern S const s = {.a = 2}; 239f902542SElla Ma // CHECK-DAG: 4:c:@s 24850361f6SRafael Stahl 25850361f6SRafael Stahl struct SF { 26850361f6SRafael Stahl const int a; 27850361f6SRafael Stahl }; 28e63b81d1SGabor Marton extern const SF sf = {.a = 2}; 299f902542SElla Ma // CHECK-DAG: 5:c:@sf 30850361f6SRafael Stahl 31850361f6SRafael Stahl struct SStatic { 32850361f6SRafael Stahl static const int a = 4; 33850361f6SRafael Stahl }; 34850361f6SRafael Stahl const int SStatic::a; 359f902542SElla Ma // CHECK-DAG: 14:c:@S@SStatic@a 36850361f6SRafael Stahl 37850361f6SRafael Stahl extern int const arr[5] = { 0, 1 }; 389f902542SElla Ma // CHECK-DAG: 6:c:@arr 39850361f6SRafael Stahl 40850361f6SRafael Stahl union U { 41850361f6SRafael Stahl const int a; 42850361f6SRafael Stahl const unsigned int b; 43850361f6SRafael Stahl }; 44e63b81d1SGabor Marton extern const U u = {.a = 6}; 459f902542SElla Ma // CHECK-DAG: 4:c:@u 464e79097dSBalazs Keri 474e79097dSBalazs Keri // No USR can be generated for this. 484e79097dSBalazs Keri // Check for no crash in this case. 494e79097dSBalazs Keri static union { 504e79097dSBalazs Keri float uf; 514e79097dSBalazs Keri const int ui; 524e79097dSBalazs Keri }; 539f902542SElla Ma 549f902542SElla Ma void f(int (*)(char)); 559f902542SElla Ma void f(bool (*)(char)); 569f902542SElla Ma 579f902542SElla Ma struct G { GG589f902542SElla Ma G() { 599f902542SElla Ma f([](char) -> int { return 42; }); 609f902542SElla Ma // CHECK-DAG: 41:c:@S@G@F@G#@Sa@F@operator int (*)(char)#1 619f902542SElla Ma f([](char) -> bool { return true; }); 629f902542SElla Ma // CHECK-DAG: 42:c:@S@G@F@G#@Sa@F@operator bool (*)(char)#1 639f902542SElla Ma } 649f902542SElla Ma }; 65