[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / attr-loader-uninitialized.cpp
blob6f68d66d56041012a186fbc726953efe7469c4a7
1 // RUN: %clang_cc1 -triple=x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
3 // CHECK: @defn ={{.*}} global i32 undef
4 int defn [[clang::loader_uninitialized]];
6 // CHECK: @_ZL11defn_static = internal global i32 undef
7 static int defn_static [[clang::loader_uninitialized]] __attribute__((used));
9 // CHECK: @_ZZ4funcvE4data = internal global i32 undef
10 int* func(void)
12 static int data [[clang::loader_uninitialized]];
13 return &data;
16 class trivial
18 float x;
21 // CHECK: @ut ={{.*}} global %class.trivial undef
22 trivial ut [[clang::loader_uninitialized]];
24 // CHECK: @arr ={{.*}} global [32 x double] undef
25 double arr[32] __attribute__((loader_uninitialized));
27 // Defining as arr2[] [[clang..]] raises the error: attribute cannot be applied to types
28 // CHECK: @arr2 ={{.*}} global [4 x double] undef
29 double arr2 [[clang::loader_uninitialized]] [4];
31 template<typename T> struct templ{T * t;};
33 // CHECK: @templ_int ={{.*}} global %struct.templ undef
34 templ<int> templ_int [[clang::loader_uninitialized]];
36 // CHECK: @templ_trivial ={{.*}} global %struct.templ.0 undef
37 templ<trivial> templ_trivial [[clang::loader_uninitialized]];
39 // CHECK: @templ_incomplete ={{.*}} global %struct.templ.1 undef
40 struct incomplete;
41 templ<incomplete> templ_incomplete [[clang::loader_uninitialized]];