diff options
author | Denis Zobnin <d.zobnin.bugzilla@gmail.com> | 2016-04-29 11:27:00 +0000 |
---|---|---|
committer | Denis Zobnin <d.zobnin.bugzilla@gmail.com> | 2016-04-29 11:27:00 +0000 |
commit | 2290dacaf894f26ac6a5058ec2cf438af87a6c96 (patch) | |
tree | 2e160cd6fe87f1dae81e5f7224c7c7044126437e /clang/test/CodeGenCXX/sections.cpp | |
parent | 0b9d105a1607fc0b1eebc25ddd06f5b5162fff5d (diff) | |
download | bcm5719-llvm-2290dacaf894f26ac6a5058ec2cf438af87a6c96.tar.gz bcm5719-llvm-2290dacaf894f26ac6a5058ec2cf438af87a6c96.zip |
Recommit "[MS] Improved implementation of stack pragmas (vtordisp, *_seg)"
Slightly updated version, double-checked build and tests.
Improve implementation of MS pragmas that use stack + compatibility fixes.
This patch:
1. Changes implementation of #pragma vtordisp to use PragmaStack class
that other stack pragmas use;
2. Fixes "#pragma vtordisp()" behavior - it shouldn't affect the stack;
3. Supports "save-restore" of pragma stacks on enter / exit a C++ method
body, as MSVC does.
TODO:
1. Change implementation of #pragma pack to use the same approach;
2. Introduce diagnostics on popping named stack slots, as MSVC does.
Reviewers:
rnk, thakis
Differential revision: http://reviews.llvm.org/D19361
llvm-svn: 268029
Diffstat (limited to 'clang/test/CodeGenCXX/sections.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/sections.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/sections.cpp b/clang/test/CodeGenCXX/sections.cpp index bec2e2d3d70..c33871a97f5 100644 --- a/clang/test/CodeGenCXX/sections.cpp +++ b/clang/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" |