| 1 |
// RUN: %clang_cc1 -triple powerpc-unknown-aix -emit-llvm -o - -x c++ %s | \ |
| 2 |
// RUN: FileCheck -check-prefix=VISIBILITY-IR %s |
| 3 |
|
| 4 |
// RUN: %clang_cc1 -triple powerpc-unknown-aix -emit-llvm -round-trip-args -o - -x c++ %s | \ |
| 5 |
// RUN: FileCheck -check-prefix=VISIBILITY-IR %s |
| 6 |
|
| 7 |
// RUN: %clang_cc1 -triple powerpc-unknown-aix -mignore-xcoff-visibility -fvisibility=default -emit-llvm -o - -x c++ %s | \ |
| 8 |
// RUN: FileCheck -check-prefix=NOVISIBILITY-IR %s |
| 9 |
|
| 10 |
// RUN: %clang_cc1 -triple powerpc-unknown-aix -mignore-xcoff-visibility -fvisibility=default -emit-llvm -round-trip-args -o - -x c++ %s | \ |
| 11 |
// RUN: FileCheck -check-prefix=NOVISIBILITY-IR %s |
| 12 |
|
| 13 |
// RUN: %clang_cc1 -triple powerpc-unknown-aix -fvisibility=default -emit-llvm -o - -x c++ %s | \ |
| 14 |
// RUN: FileCheck -check-prefix=VISIBILITY-IR %s |
| 15 |
|
| 16 |
// RUN: %clang_cc1 -triple powerpc-unknown-aix -fvisibility=default -round-trip-args -emit-llvm -o - -x c++ %s | \ |
| 17 |
// RUN: FileCheck -check-prefix=VISIBILITY-IR %s |
| 18 |
|
| 19 |
__attribute__((visibility("hidden"))) void foo_h(int *p) { |
| 20 |
(*p)++; |
| 21 |
} |
| 22 |
|
| 23 |
__attribute__((visibility("protected"))) int b; |
| 24 |
|
| 25 |
extern __attribute__((visibility("hidden"))) void zoo_extern_h(void); |
| 26 |
|
| 27 |
void (*foo_p)(void) = zoo_extern_h; |
| 28 |
|
| 29 |
__attribute__((visibility("protected"))) void bar() { |
| 30 |
foo_h(&b); |
| 31 |
foo_p(); |
| 32 |
} |
| 33 |
|
| 34 |
class TestClass { |
| 35 |
public: |
| 36 |
__attribute__((__visibility__("hidden"))) int value() const noexcept { return 0; } |
| 37 |
}; |
| 38 |
|
| 39 |
int main() { |
| 40 |
TestClass TC; |
| 41 |
return TC.value(); |
| 42 |
} |
| 43 |
|
| 44 |
template <class T> |
| 45 |
class basic { |
| 46 |
public: |
| 47 |
__attribute__((__visibility__("protected"))) int getdata() { return 1; } |
| 48 |
}; |
| 49 |
|
| 50 |
template class basic<int>; |
| 51 |
|
| 52 |
#pragma GCC visibility push(hidden) |
| 53 |
int pramb; |
| 54 |
void prambar() {} |
| 55 |
#pragma GCC visibility pop |
| 56 |
|
| 57 |
// VISIBILITY-IR: @b = protected global i32 0 |
| 58 |
// VISIBILITY-IR: @pramb = hidden global i32 0 |
| 59 |
// VISIBILITY-IR: define hidden void @_Z5foo_hPi(ptr noundef %p) |
| 60 |
// VISIBILITY-IR: declare hidden void @_Z12zoo_extern_hv() |
| 61 |
// VISIBILITY-IR: define protected void @_Z3barv() |
| 62 |
// VISIBILITY-IR: define linkonce_odr hidden noundef i32 @_ZNK9TestClass5valueEv(ptr {{[^,]*}} %this) |
| 63 |
// VISIBILITY-IR: define weak_odr protected noundef i32 @_ZN5basicIiE7getdataEv(ptr {{[^,]*}} %this) |
| 64 |
// VISIBILITY-IR: define hidden void @_Z7prambarv() |
| 65 |
|
| 66 |
// NOVISIBILITY-IR: @b = global i32 0 |
| 67 |
// NOVISIBILITY-IR: @pramb = global i32 0 |
| 68 |
// NOVISIBILITY-IR: define void @_Z5foo_hPi(ptr noundef %p) |
| 69 |
// NOVISIBILITY-IR: declare void @_Z12zoo_extern_hv() |
| 70 |
// NOVISIBILITY-IR: define void @_Z3barv() |
| 71 |
// NOVISIBILITY-IR: define linkonce_odr noundef i32 @_ZNK9TestClass5valueEv(ptr {{[^,]*}} %this) |
| 72 |
// NOVISIBILITY-IR: define weak_odr noundef i32 @_ZN5basicIiE7getdataEv(ptr {{[^,]*}} %this) |
| 73 |
// NOVISIBILITY-IR: define void @_Z7prambarv() |