Avoid using a local static for providing lexical
order of priorotized global object initializations.
llvm-svn: 106503
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp
index 9faaed5..c2e2dd0 100644
--- a/clang/lib/CodeGen/CGDeclCXX.cpp
+++ b/clang/lib/CodeGen/CGDeclCXX.cpp
@@ -172,10 +172,8 @@
CodeGenFunction(*this).GenerateCXXGlobalVarDeclInitFunc(Fn, D);
if (D->hasAttr<InitPriorityAttr>()) {
- static unsigned lix = 0; // to keep the lexical order of equal priority
- // objects intact;
unsigned int order = D->getAttr<InitPriorityAttr>()->getPriority();
- OrderGlobalInitsType Key(order, lix++);
+ OrderGlobalInitsType Key(order, PrioritizedCXXGlobalInits.size());
PrioritizedCXXGlobalInits.push_back(std::make_pair(Key, Fn));
}
else