forked from OSchip/llvm-project
PR33924: Merge block-scope anonymous declarations if there are multiple definitions of the enclosing function.
llvm-svn: 314956
This commit is contained in:
parent
3ea492ad74
commit
b80e7533bf
|
@ -344,8 +344,8 @@ bool serialization::needsAnonymousDeclarationNumber(const NamedDecl *D) {
|
|||
return true;
|
||||
}
|
||||
|
||||
// Otherwise, we only care about anonymous class members.
|
||||
if (D->getDeclName() || !isa<CXXRecordDecl>(D->getLexicalDeclContext()))
|
||||
// Otherwise, we only care about anonymous class members / block-scope decls.
|
||||
if (D->getDeclName() || D->getLexicalDeclContext()->isFileContext())
|
||||
return false;
|
||||
return isa<TagDecl>(D) || isa<FieldDecl>(D);
|
||||
}
|
||||
|
|
|
@ -467,6 +467,7 @@ FunctionDecl *ASTDeclReader::TryRegisterAsFunctionDefinition(FunctionDecl *D) {
|
|||
// declaration.
|
||||
if (Definition != D) {
|
||||
// Already have a different definition, merge this one into it.
|
||||
Reader.MergedDeclContexts.insert(std::make_pair(D, Definition));
|
||||
Reader.mergeDefinitionVisibility(Definition, D);
|
||||
}
|
||||
return Definition;
|
||||
|
|
Loading…
Reference in New Issue