diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-02-16 09:31:36 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-02-16 09:31:36 +0000 |
commit | fd035e6496665b1f1197868e21cb0a4594e8db6e (patch) | |
tree | 53010172e19c77ea447bcd89e117cda052ab52e0 /test/CodeGenCXX/visibility.cpp | |
parent | 2fce988e86bc01829142e4362d4eff1af0925147 (diff) | |
download | FreeBSD-src-fd035e6496665b1f1197868e21cb0a4594e8db6e.zip FreeBSD-src-fd035e6496665b1f1197868e21cb0a4594e8db6e.tar.gz |
Update clang to r96341.
Diffstat (limited to 'test/CodeGenCXX/visibility.cpp')
-rw-r--r-- | test/CodeGenCXX/visibility.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/test/CodeGenCXX/visibility.cpp b/test/CodeGenCXX/visibility.cpp new file mode 100644 index 0000000..5edd27b --- /dev/null +++ b/test/CodeGenCXX/visibility.cpp @@ -0,0 +1,66 @@ +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s + +#define HIDDEN __attribute__((visibility("hidden"))) +#define PROTECTED __attribute__((visibility("protected"))) +#define DEFAULT __attribute__((visibility("default"))) + +// CHECK: @_ZN5Test425VariableInHiddenNamespaceE = hidden global i32 10 + +namespace Test1 { + // CHECK: define hidden void @_ZN5Test11fEv + void HIDDEN f() { } + +} + +namespace Test2 { + struct HIDDEN A { + void f(); + }; + + // A::f is a member function of a hidden class. + // CHECK: define hidden void @_ZN5Test21A1fEv + void A::f() { } +} + +namespace Test3 { + struct HIDDEN A { + struct B { + void f(); + }; + }; + + // B is a nested class where its parent class is hidden. + // CHECK: define hidden void @_ZN5Test31A1B1fEv + void A::B::f() { } +} + +namespace Test4 HIDDEN { + int VariableInHiddenNamespace = 10; + + // Test4::g is in a hidden namespace. + // CHECK: define hidden void @_ZN5Test41gEv + void g() { } + + struct DEFAULT A { + void f(); + }; + + // A has default visibility. + // CHECK: define void @_ZN5Test41A1fEv + void A::f() { } +} + +namespace Test5 { + + namespace NS HIDDEN { + // f is in NS which is hidden. + // CHECK: define hidden void @_ZN5Test52NS1fEv() + void f() { } + } + + namespace NS { + // g is in NS, but this NS decl is not hidden. + // CHECK: define void @_ZN5Test52NS1gEv + void g() { } + } +} |