diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
| commit | 2b6b257f4e5503a7a2675bdb8735693db769f75c (patch) | |
| tree | e85e046ae7003fe3bcc8b5454cd0fa3f7407b470 /test/CodeGenCXX/sections.cpp | |
| parent | b4348ed0b7e90c0831b925fbee00b5f179a99796 (diff) | |
Notes
Diffstat (limited to 'test/CodeGenCXX/sections.cpp')
| -rw-r--r-- | test/CodeGenCXX/sections.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/CodeGenCXX/sections.cpp b/test/CodeGenCXX/sections.cpp index bec2e2d3d706..c33871a97f56 100644 --- a/test/CodeGenCXX/sections.cpp +++ b/test/CodeGenCXX/sections.cpp @@ -31,6 +31,31 @@ int TEST1; #pragma bss_seg(pop) int TEST2; + +// Check "save-restore" of pragma stacks. +struct Outer { + void f() { + #pragma bss_seg(push, ".bss3") + #pragma code_seg(push, ".my_code1") + #pragma const_seg(push, ".my_const1") + #pragma data_seg(push, ".data3") + struct Inner { + void g() { + #pragma bss_seg(push, ".bss4") + #pragma code_seg(push, ".my_code2") + #pragma const_seg(push, ".my_const2") + #pragma data_seg(push, ".data4") + } + }; + } +}; + +void h2(void) {} // should be in ".my_code" +int TEST3; // should be in ".bss1" +int d2 = 1; // should be in ".data" +extern const int b2; // should be in ".my_const" +const int b2 = 1; + #pragma section("read_flag_section", read) // Even though they are not declared const, these become constant since they are // in a read-only section. @@ -63,6 +88,9 @@ __declspec(allocate("short_section")) short short_var = 42; //CHECK: @i = global i32 0 //CHECK: @TEST1 = global i32 0 //CHECK: @TEST2 = global i32 0, section ".bss1" +//CHECK: @TEST3 = global i32 0, section ".bss1" +//CHECK: @d2 = global i32 1, section ".data" +//CHECK: @b2 = constant i32 1, section ".my_const" //CHECK: @unreferenced = constant i32 0, section "read_flag_section" //CHECK: @referenced = constant i32 42, section "read_flag_section" //CHECK: @implicitly_read_write = global i32 42, section "no_section_attributes" @@ -70,3 +98,4 @@ __declspec(allocate("short_section")) short short_var = 42; //CHECK: @short_var = global i16 42, section "short_section" //CHECK: define void @g() //CHECK: define void @h() {{.*}} section ".my_code" +//CHECK: define void @h2() {{.*}} section ".my_code" |
