summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/sections.cpp
diff options
context:
space:
mode:
authorDenis Zobnin <d.zobnin.bugzilla@gmail.com>2016-04-28 10:13:18 +0000
committerDenis Zobnin <d.zobnin.bugzilla@gmail.com>2016-04-28 10:13:18 +0000
commit2008dbb4ed56a93f0cb6cbd90721d9c469442b5f (patch)
treefbef55ef756e132952b1e58bea6c918ade0024cc /clang/test/CodeGenCXX/sections.cpp
parent5b4faeec8705aeecd9c7d5cb90ece6f50c459195 (diff)
downloadbcm5719-llvm-2008dbb4ed56a93f0cb6cbd90721d9c469442b5f.tar.gz
bcm5719-llvm-2008dbb4ed56a93f0cb6cbd90721d9c469442b5f.zip
[MS] Improved implementation of MS stack pragmas (vtordisp, *_seg)
Rework implementation of several MS pragmas that use internal stack: vtordisp, {bss|code|const|data}_seg. This patch: 1. Makes #pragma vtordisp use PragmaStack class as *_seg pragmas do; 2. Fixes "#pragma vtordisp()" behavior: it shouldn't affect stack; 3. Saves/restores the stacks on enter/exit a C++ method body. llvm-svn: 267866
Diffstat (limited to 'clang/test/CodeGenCXX/sections.cpp')
-rw-r--r--clang/test/CodeGenCXX/sections.cpp29
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"
OpenPOWER on IntegriCloud