Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / internal-linkage.cpp
blob27b69cc0764d5ee5ab12f41d021b9c0ab1f4bf0c
1 // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s
3 struct Global { Global(); };
4 template<typename T> struct X { X() {} };
7 namespace {
8 struct Anon { Anon() {} };
10 // CHECK: @_ZN12_GLOBAL__N_15anon0E = internal global
11 Global anon0;
14 // CHECK: @anon1 = internal global
15 Anon anon1;
17 // CHECK: @anon2 = internal global
18 X<Anon> anon2;
20 char const * const xyzzy = "Hello, world!";
21 extern char const * const xyzzy;
23 char const * const *test1()
25 // CHECK: @_ZL5xyzzy = internal constant
26 return &xyzzy;
29 static char const * const static_xyzzy = "Hello, world!";
30 extern char const * const static_xyzzy;
32 char const * const *test2()
34 // CHECK: @_ZL12static_xyzzy = internal constant
35 return &static_xyzzy;
38 static char const * static_nonconst_xyzzy = "Hello, world!";
39 extern char const * static_nonconst_xyzzy;
41 char const * *test3()
43 // CHECK: @_ZL21static_nonconst_xyzzy = internal global
44 return &static_nonconst_xyzzy;
48 char const * extern_nonconst_xyzzy = "Hello, world!";
49 extern char const * extern_nonconst_xyzzy;
51 char const * *test4()
53 // CHECK: @extern_nonconst_xyzzy = {{(dso_local )?}}global
54 return &extern_nonconst_xyzzy;
57 // PR10120
58 template <typename T> class klass {
59 virtual void f();
61 namespace { struct S; }
62 void foo () { klass<S> x; }
63 // CHECK: @_ZTV5klassIN12_GLOBAL__N_11SEE = internal unnamed_addr constant