summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index ee475d3cc52..3e04bc5ad7d 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -5751,8 +5751,16 @@ static bool isImportedDeclContext(ASTReader *Chain, const Decl *D) {
}
void ASTWriter::AddedVisibleDecl(const DeclContext *DC, const Decl *D) {
- // TU and namespaces are handled elsewhere.
- if (isa<TranslationUnitDecl>(DC) || isa<NamespaceDecl>(DC))
+ // TU is handled elsewhere.
+ if (isa<TranslationUnitDecl>(DC))
+ return;
+
+ // Namespaces are handled elsewhere, except for template instantiations of
+ // FunctionTemplateDecls in namespaces. We are interested in cases where the
+ // local instantiations are added to an imported context. Only happens when
+ // adding ADL lookup candidates, for example templated friends.
+ if (isa<NamespaceDecl>(DC) && D->getFriendObjectKind() == Decl::FOK_None &&
+ !isa<FunctionTemplateDecl>(D))
return;
// We're only interested in cases where a local declaration is added to an
OpenPOWER on IntegriCloud