summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-startend.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2012-02-25 20:51:20 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2012-02-25 20:51:20 +0000
commit4a7eab25455e68ce928c5fcd7947998118e5cb5c (patch)
treeca4e084cf67dbad4e1de245e56b849f800ac2b31 /clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-startend.cpp
parentf2e0a3077cf34a537300f34b0457c91f35e40785 (diff)
downloadbcm5719-llvm-4a7eab25455e68ce928c5fcd7947998118e5cb5c.tar.gz
bcm5719-llvm-4a7eab25455e68ce928c5fcd7947998118e5cb5c.zip
CodeGen support for global variables of type std::initializer_list<X>.
This emits a backing array with internal linkage and fills it with data, then has the initializer_list point at the array. Dynamic initialization and global destructors are correctly supported. What doesn't work is nested initializer_lists. I have no idea how to get them to work, either. However, these should be very rare, and so I'll just call it a known bug and declare generalized initializers DONE! llvm-svn: 151457
Diffstat (limited to 'clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-startend.cpp')
-rw-r--r--clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-startend.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-startend.cpp b/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-startend.cpp
index 3ab44e57123..c533e453a5e 100644
--- a/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-startend.cpp
+++ b/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist-startend.cpp
@@ -32,6 +32,10 @@ namespace std {
};
}
+// CHECK: @_ZL25globalInitList1__initlist = internal global [3 x i32] [i32 1, i32 2, i32 3]
+// CHECK: @globalInitList1 = global {{[^ ]+}} { i32* getelementptr inbounds ([3 x i32]* @_ZL25globalInitList1__initlist, {{[^)]*}}), i32*
+std::initializer_list<int> globalInitList1 = {1, 2, 3};
+
void fn1(int i) {
// CHECK: define void @_Z3fn1i
// temporary array
OpenPOWER on IntegriCloud