[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / global-decls.c
blobb817c50a133b61068b1b268900cdf418b087a9ad
1 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o %t %s
3 // RUN: grep '@g0_ext = extern_weak global i32' %t
4 extern int g0_ext __attribute__((weak));
5 // RUN: grep 'declare extern_weak i32 @g1_ext()' %t
6 extern int __attribute__((weak)) g1_ext (void);
8 // RUN: grep '@g0_common = weak global i32' %t
9 int g0_common __attribute__((weak));
11 // RUN: grep '@g0_def = weak global i32' %t
12 int g0_def __attribute__((weak)) = 52;
13 // RUN: grep 'define weak i32 @g1_def()' %t
14 int __attribute__((weak)) g1_def (void) { return 0; }
16 // Force _ext references
17 void f0(void) {
18 int a = g0_ext;
19 int b = g1_ext();