• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // UNSUPPORTED: system-windows
2 // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
3 
4 // CHECK: @defn = global i32 undef
5 int defn  [[clang::loader_uninitialized]];
6 
7 // CHECK: @_ZL11defn_static = internal global i32 undef
8 static int defn_static [[clang::loader_uninitialized]] __attribute__((used));
9 
10 // CHECK: @_ZZ4funcvE4data = internal global i32 undef
func(void)11 int* func(void)
12 {
13   static int data [[clang::loader_uninitialized]];
14   return &data;
15 }
16 
17 class trivial
18 {
19   float x;
20 };
21 
22 // CHECK: @ut = global %class.trivial undef
23 trivial ut [[clang::loader_uninitialized]];
24 
25 // CHECK: @arr = global [32 x double] undef
26 double arr[32] __attribute__((loader_uninitialized));
27 
28 // Defining as arr2[] [[clang..]] raises the error: attribute cannot be applied to types
29 // CHECK: @arr2 = global [4 x double] undef
30 double arr2 [[clang::loader_uninitialized]] [4];
31 
32 template<typename T> struct templ{T * t;};
33 
34 // CHECK: @templ_int = global %struct.templ undef
35 templ<int> templ_int [[clang::loader_uninitialized]];
36 
37 // CHECK: @templ_trivial = global %struct.templ.0 undef
38 templ<trivial> templ_trivial [[clang::loader_uninitialized]];
39 
40 // CHECK: @templ_incomplete = global %struct.templ.1 undef
41 struct incomplete;
42 templ<incomplete> templ_incomplete [[clang::loader_uninitialized]];
43