Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -emit-llvm -fms-extensions -xc++ -o - < %s | FileCheck %s
      2 
      3 #ifdef __cplusplus
      4 extern "C" {
      5 #endif
      6 #pragma const_seg(".my_const")
      7 #pragma bss_seg(".my_bss")
      8 int D = 1;
      9 #pragma data_seg(".data")
     10 int a = 1;
     11 #pragma data_seg(push, label, ".data2")
     12 extern const int b;
     13 const int b = 1;
     14 const char* s = "my string!";
     15 #pragma data_seg(push, ".my_seg")
     16 int c = 1;
     17 #pragma data_seg(pop, label)
     18 int d = 1;
     19 int e;
     20 #pragma bss_seg(".c")
     21 int f;
     22 void g(void){}
     23 #pragma code_seg(".my_code")
     24 void h(void){}
     25 #pragma bss_seg()
     26 int i;
     27 #pragma bss_seg(".bss1")
     28 #pragma bss_seg(push, test, ".bss2")
     29 #pragma bss_seg()
     30 #pragma bss_seg()
     31 int TEST1;
     32 #pragma bss_seg(pop)
     33 int TEST2;
     34 #ifdef __cplusplus
     35 }
     36 #endif
     37 
     38 //CHECK: @D = global i32 1
     39 //CHECK: @a = global i32 1, section ".data"
     40 //CHECK: @b = constant i32 1, section ".my_const"
     41 //CHECK: @[[MYSTR:.*]] = {{.*}} unnamed_addr constant [11 x i8] c"my string!\00"
     42 //CHECK: @s = global i8* getelementptr inbounds ([11 x i8]* @[[MYSTR]], i32 0, i32 0), section ".data2"
     43 //CHECK: @c = global i32 1, section ".my_seg"
     44 //CHECK: @d = global i32 1, section ".data"
     45 //CHECK: @e = global i32 0, section ".my_bss"
     46 //CHECK: @f = global i32 0, section ".c"
     47 //CHECK: @i = global i32 0
     48 //CHECK: @TEST1 = global i32 0
     49 //CHECK: @TEST2 = global i32 0, section ".bss1"
     50 //CHECK: define void @g()
     51 //CHECK: define void @h() {{.*}} section ".my_code"
     52