brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · e5d242d Raw
65 lines · cpp
1// RUN: %clang_extdef_map %s -- | FileCheck --implicit-check-not "c:@y" --implicit-check-not "c:@z" %s2// RUN: %clang -emit-ast %s -o %t.ast3// RUN: %clang_extdef_map %t.ast -- | FileCheck --implicit-check-not "c:@y" --implicit-check-not "c:@z" %s4 5int f(int) {6  return 0;7}8// CHECK-DAG: 9:c:@F@f#I#9 10extern const int x = 5;11// CHECK-DAG: 4:c:@x12 13// Non-const variables should not be collected.14int y = 5;15 16// In C++, const implies internal linkage, so not collected.17const int z = 5;18 19struct S {20  int a;21};22extern S const s = {.a = 2};23// CHECK-DAG: 4:c:@s24 25struct SF {26  const int a;27};28extern const SF sf = {.a = 2};29// CHECK-DAG: 5:c:@sf30 31struct SStatic {32  static const int a = 4;33};34const int SStatic::a;35// CHECK-DAG: 14:c:@S@SStatic@a36 37extern int const arr[5] = { 0, 1 };38// CHECK-DAG: 6:c:@arr39 40union U {41  const int a;42  const unsigned int b;43};44extern const U u = {.a = 6};45// CHECK-DAG: 4:c:@u46 47// No USR can be generated for this.48// Check for no crash in this case.49static union {50  float uf;51  const int ui;52};53 54void f(int (*)(char));55void f(bool (*)(char));56 57struct G {58  G() {59    f([](char) -> int { return 42; });60    // CHECK-DAG: 41:c:@S@G@F@G#@Sa@F@operator int (*)(char)#161    f([](char) -> bool { return true; });62    // CHECK-DAG: 42:c:@S@G@F@G#@Sa@F@operator bool (*)(char)#163  }64};65