Do not emit duplicate global initializers for template static data members inside namespaces
A quirk of AST representation leads to class template static data member definitions being visited twice during Clang IRGen resulting in duplicate (benign) initializers. Discovered while investigating a possibly-related debug info bug tickled by the duplicate emission of these members & their associated debug info. With thanks to Richard Smith for help investigating, understanding, and helping with the fix. llvm-svn: 189996
This commit is contained in:
@@ -2761,8 +2761,13 @@ void CodeGenModule::EmitObjCIvarInitializations(ObjCImplementationDecl *D) {
|
||||
/// EmitNamespace - Emit all declarations in a namespace.
|
||||
void CodeGenModule::EmitNamespace(const NamespaceDecl *ND) {
|
||||
for (RecordDecl::decl_iterator I = ND->decls_begin(), E = ND->decls_end();
|
||||
I != E; ++I)
|
||||
I != E; ++I) {
|
||||
if (const VarDecl *VD = dyn_cast<VarDecl>(*I))
|
||||
if (VD->getTemplateSpecializationKind() != TSK_ExplicitSpecialization &&
|
||||
VD->getTemplateSpecializationKind() != TSK_Undeclared)
|
||||
continue;
|
||||
EmitTopLevelDecl(*I);
|
||||
}
|
||||
}
|
||||
|
||||
// EmitLinkageSpec - Emit all declarations in a linkage spec.
|
||||
|
||||
Reference in New Issue
Block a user