Debian Codegraph @

clang/test/CodeGenCXX/internal-linkage.cpp

raw
1 // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s
2
3 struct Global { Global(); };
4 template<typename T> struct X { X() {} };
5
6
7 namespace {
8 struct Anon { Anon() {} };
9
10 // CHECK: @_ZN12_GLOBAL__N_15anon0E = internal global
11 Global anon0;
12 }
13
14 // CHECK: @anon1 = internal global
15 Anon anon1;
16
17 // CHECK: @anon2 = internal global
18 X<Anon> anon2;
19
20 char const * const xyzzy = "Hello, world!";
21 extern char const * const xyzzy;
22
23 char const * const *test1()
24 {
25 // CHECK: @_ZL5xyzzy = internal constant
26 return &xyzzy;
27 }
28
29 static char const * const static_xyzzy = "Hello, world!";
30 extern char const * const static_xyzzy;
31
32 char const * const *test2()
33 {
34 // CHECK: @_ZL12static_xyzzy = internal constant
35 return &static_xyzzy;
36 }
37
38 static char const * static_nonconst_xyzzy = "Hello, world!";
39 extern char const * static_nonconst_xyzzy;
40
41 char const * *test3()
42 {
43 // CHECK: @_ZL21static_nonconst_xyzzy = internal global
44 return &static_nonconst_xyzzy;
45 }
46
47
48 char const * extern_nonconst_xyzzy = "Hello, world!";
49 extern char const * extern_nonconst_xyzzy;
50
51 char const * *test4()
52 {
53 // CHECK: @extern_nonconst_xyzzy = {{(dso_local )?}}global
54 return &extern_nonconst_xyzzy;
55 }
56
57 // PR10120
58 template <typename T> class klass {
59 virtual void f();
60 };
61 namespace { struct S; }
62 void foo () { klass<S> x; }
63 // CHECK: @_ZTV5klassIN12_GLOBAL__N_11SEE = internal unnamed_addr constant