minix/external/bsd/llvm/dist/clang/test/CodeGenCXX/internal-linkage.cpp
Lionel Sambuc f4a2713ac8 Importing netbsd clang -- pristine
Change-Id: Ia40e9ffdf29b5dab2f122f673ff6802a58bc690f
2014-07-28 17:05:57 +02:00

64 lines
1.3 KiB
C++

// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
struct Global { Global(); };
template<typename T> struct X { X() {} };
namespace {
struct Anon { Anon() {} };
// CHECK: @_ZN12_GLOBAL__N_15anon0E = internal global
Global anon0;
}
// CHECK: @anon1 = internal global
Anon anon1;
// CHECK: @anon2 = internal global
X<Anon> anon2;
// rdar: // 8071804
char const * const xyzzy = "Hello, world!";
extern char const * const xyzzy;
char const * const *test1()
{
// CHECK: @_ZL5xyzzy = internal constant
return &xyzzy;
}
static char const * const static_xyzzy = "Hello, world!";
extern char const * const static_xyzzy;
char const * const *test2()
{
// CHECK: @_ZL12static_xyzzy = internal constant
return &static_xyzzy;
}
static char const * static_nonconst_xyzzy = "Hello, world!";
extern char const * static_nonconst_xyzzy;
char const * *test3()
{
// CHECK: @_ZL21static_nonconst_xyzzy = internal global
return &static_nonconst_xyzzy;
}
char const * extern_nonconst_xyzzy = "Hello, world!";
extern char const * extern_nonconst_xyzzy;
char const * *test4()
{
// CHECK: @extern_nonconst_xyzzy = global
return &extern_nonconst_xyzzy;
}
// PR10120
template <typename T> class klass {
virtual void f();
};
namespace { struct S; }
void foo () { klass<S> x; }
// CHECK: @_ZTV5klassIN12_GLOBAL__N_11SEE = internal unnamed_addr constant