diff options
author | Hans Wennborg <hans@hanshq.net> | 2014-10-17 18:13:21 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2014-10-17 18:13:21 +0000 |
commit | 355e8c8de83ab6633bfd42f44e16f8a6209b46f1 (patch) | |
tree | 0ccc40af8f1fabb35f7be18d8d4995165b972bce /test/CodeGenCXX/sections.cpp | |
parent | 34364392336ffeb4e76e5583bce9537aec4aaa75 (diff) |
Move test/CodeGen/sections.c to CodeGenCXX/sections.cpp
The test was running with -xc++. Seems it wants to be a C++ file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220069 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/sections.cpp')
-rw-r--r-- | test/CodeGenCXX/sections.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/CodeGenCXX/sections.cpp b/test/CodeGenCXX/sections.cpp new file mode 100644 index 0000000000..ba2c1255f7 --- /dev/null +++ b/test/CodeGenCXX/sections.cpp @@ -0,0 +1,58 @@ +// RUN: %clang_cc1 -emit-llvm -triple i686-pc-win32 -fms-extensions -o - %s | FileCheck %s + +extern "C" { + +#pragma const_seg(".my_const") +#pragma bss_seg(".my_bss") +int D = 1; +#pragma data_seg(".data") +int a = 1; +#pragma data_seg(push, label, ".data2") +extern const int b; +const int b = 1; +const char* s = "my string!"; +#pragma data_seg(push, ".my_seg") +int c = 1; +#pragma data_seg(pop, label) +int d = 1; +int e; +#pragma bss_seg(".c") +int f; +void g(void){} +#pragma code_seg(".my_code") +void h(void){} +#pragma bss_seg() +int i; +#pragma bss_seg(".bss1") +#pragma bss_seg(push, test, ".bss2") +#pragma bss_seg() +#pragma bss_seg() +int TEST1; +#pragma bss_seg(pop) +int TEST2; + +#pragma section("read_flag_section", read) +// Even though they are not declared const, these become constant since they are +// in a read-only section. +__declspec(allocate("read_flag_section")) int unreferenced = 0; +extern __declspec(allocate("read_flag_section")) int referenced = 42; +int *user() { return &referenced; } + +} + +//CHECK: @D = global i32 1 +//CHECK: @a = global i32 1, section ".data" +//CHECK: @b = constant i32 1, section ".my_const" +//CHECK: @[[MYSTR:.*]] = {{.*}} unnamed_addr constant [11 x i8] c"my string!\00" +//CHECK: @s = global i8* getelementptr inbounds ([11 x i8]* @[[MYSTR]], i32 0, i32 0), section ".data2" +//CHECK: @c = global i32 1, section ".my_seg" +//CHECK: @d = global i32 1, section ".data" +//CHECK: @e = global i32 0, section ".my_bss" +//CHECK: @f = global i32 0, section ".c" +//CHECK: @i = global i32 0 +//CHECK: @TEST1 = global i32 0 +//CHECK: @TEST2 = global i32 0, section ".bss1" +//CHECK: @unreferenced = constant i32 0, section "read_flag_section" +//CHECK: @referenced = constant i32 42, section "read_flag_section" +//CHECK: define void @g() +//CHECK: define void @h() {{.*}} section ".my_code" |