diff options
| author | Reid Kleckner <reid@kleckner.net> | 2013-09-04 00:54:24 +0000 |
|---|---|---|
| committer | Reid Kleckner <reid@kleckner.net> | 2013-09-04 00:54:24 +0000 |
| commit | 2753324e82d4404da579fd359e8ba5ef46c9a320 (patch) | |
| tree | 10fb1240d5c1d3e3653b3dcc8ef219d64467ab6f /clang/lib/CodeGen | |
| parent | 959aebf873a32c7b16e929e48cf8d94a816a8074 (diff) | |
| download | bcm5719-llvm-2753324e82d4404da579fd359e8ba5ef46c9a320.tar.gz bcm5719-llvm-2753324e82d4404da579fd359e8ba5ef46c9a320.zip | |
Order initializers of static data members of explicit specializations
I tried to implement this properly in r189051, but I didn't have enough
test coverage. Richard kindly provided more test cases than I could
possibly imagine and now we should have the correct condition.
llvm-svn: 189898
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGDeclCXX.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp index bf5e37733b4..868820a0813 100644 --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -276,12 +276,13 @@ CodeGenModule::EmitCXXGlobalVarDeclInitFunc(const VarDecl *D, OrderGlobalInits Key(order, PrioritizedCXXGlobalInits.size()); PrioritizedCXXGlobalInits.push_back(std::make_pair(Key, Fn)); DelayedCXXInitPosition.erase(D); - } else if (D->getInstantiatedFromStaticDataMember()) { + } else if (D->getTemplateSpecializationKind() != TSK_ExplicitSpecialization && + D->getTemplateSpecializationKind() != TSK_Undeclared) { // C++ [basic.start.init]p2: - // Defnitions of explicitly specialized class template static data members - // have ordered initialization. Other class template static data members - // (i.e., implicitly or explicitly instantiated specializations) have - // unordered initialization. + // Definitions of explicitly specialized class template static data + // members have ordered initialization. Other class template static data + // members (i.e., implicitly or explicitly instantiated specializations) + // have unordered initialization. // // As a consequence, we can put them into their own llvm.global_ctors entry. // This should allow GlobalOpt to fire more often, and allow us to implement |

