Fix the bug that would cause Python to crash at startup.
When emitting the static variables we need to make sure that the order is preserved.
Fix this by making StaticDecls a std::list which has O(1) random removal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61621 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/static-order.c b/test/CodeGen/static-order.c
new file mode 100644
index 0000000..c63f4ed
--- /dev/null
+++ b/test/CodeGen/static-order.c
@@ -0,0 +1,19 @@
+// RUN: clang -emit-llvm -o - %s | not grep "zeroinitializer"
+
+struct s {
+ int a;
+};
+
+static void *v;
+
+static struct s a;
+
+static struct s a = {
+ 10
+};
+
+void *f()
+{
+ if (a.a)
+ return v;
+}