Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / set-visibility-for-decls.c
blob36f150f8ecf826d6aaa44176afdd83ba10ef5f08
1 // RUN: %clang_cc1 %s -std=c11 -triple=x86_64-pc-linux -fvisibility=hidden -fapply-global-visibility-to-externs -emit-llvm -o - | FileCheck --check-prefix=CHECK-HIDDEN %s
2 // RUN: %clang_cc1 %s -std=c11 -triple=x86_64-pc-linux -fvisibility=protected -fapply-global-visibility-to-externs -emit-llvm -o - | FileCheck --check-prefix=CHECK-PROTECTED %s
3 // RUN: %clang_cc1 %s -std=c11 -triple=x86_64-pc-linux -fvisibility=default -fapply-global-visibility-to-externs -emit-llvm -o - | FileCheck --check-prefix=CHECK-DEFAULT %s
5 // CHECK-HIDDEN: @var_hidden = external hidden global
6 // CHECK-PROTECTED: @var_hidden = external hidden global
7 // CHECK-DEFAULT: @var_hidden = external hidden global
8 __attribute__((visibility("hidden"))) extern int var_hidden;
9 // CHECK-HIDDEN: @var_protected = external protected global
10 // CHECK-PROTECTED: @var_protected = external protected global
11 // CHECK-DEFAULT: @var_protected = external protected global
12 __attribute__((visibility("protected"))) extern int var_protected;
13 // CHECK-HIDDEN: @var_default = external global
14 // CHECK-PROTECTED: @var_default = external global
15 // CHECK-DEFAULT: @var_default = external global
16 __attribute__((visibility("default"))) extern int var_default;
17 // CHECK-HIDDEN: @var = external hidden global
18 // CHECK-PROTECTED: @var = external protected global
19 // CHECK-DEFAULT: @var = external global
20 extern int var;
22 // CHECK-HIDDEN: declare hidden i32 @func_hidden()
23 // CHECK-PROTECTED: declare hidden i32 @func_hidden()
24 // CHECK-DEFAULT: declare hidden i32 @func_hidden()
25 __attribute__((visibility("hidden"))) int func_hidden(void);
26 // CHECK-HIDDEN: declare protected i32 @func_protected()
27 // CHECK-PROTECTED: declare protected i32 @func_protected()
28 // CHECK-DEFAULT: declare protected i32 @func_protected()
29 __attribute__((visibility("protected"))) int func_protected(void);
30 // CHECK-HIDDEN: declare i32 @func_default()
31 // CHECK-PROTECTED: declare i32 @func_default()
32 // CHECK-DEFAULT: declare i32 @func_default()
33 __attribute__((visibility("default"))) int func_default(void);
34 // CHECK-HIDDEN: declare hidden i32 @func()
35 // CHECK-PROTECTED: declare protected i32 @func()
36 // CHECK-DEFAULT: declare i32 @func()
37 int func(void);
39 int use(void) {
40 return var_hidden + var_protected + var_default + var +
41 func_hidden() + func_protected() + func_default() + func();