summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVassil Vassilev <v.g.vassilev@gmail.com>2016-04-06 20:56:03 +0000
committerVassil Vassilev <v.g.vassilev@gmail.com>2016-04-06 20:56:03 +0000
commit71eafded8950b40f1c0a617b74724450d9cabc71 (patch)
tree0b30e83c1bc95623e37f2401a4d8cddd9ae41c74
parent1951cf24a789119d500f1e5f042b309cb70c3958 (diff)
downloadbcm5719-llvm-71eafded8950b40f1c0a617b74724450d9cabc71.tar.gz
bcm5719-llvm-71eafded8950b40f1c0a617b74724450d9cabc71.zip
[modules] Don't try to add lookup results to non-lookup contexts.
Fixes https://llvm.org/bugs/show_bug.cgi?id=27186 Patch reviewed by Richard Smith. llvm-svn: 265597
-rw-r--r--clang/lib/AST/DeclBase.cpp7
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp3
2 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index 5ec05a6604b..2722b82ef12 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -1559,9 +1559,12 @@ void DeclContext::makeDeclVisibleInContextWithFlags(NamedDecl *D, bool Internal,
bool Recoverable) {
assert(this == getPrimaryContext() && "expected a primary DC");
- // Skip declarations within functions.
- if (isFunctionOrMethod())
+ if (!isLookupContext()) {
+ if (isTransparentContext())
+ getParent()->getPrimaryContext()
+ ->makeDeclVisibleInContextWithFlags(D, Internal, Recoverable);
return;
+ }
// Skip declarations which should be invisible to name lookup.
if (shouldBeHidden(D))
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 4dec7279781..ef7d8ee2ad2 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -5736,6 +5736,9 @@ static bool isImportedDeclContext(ASTReader *Chain, const Decl *D) {
}
void ASTWriter::AddedVisibleDecl(const DeclContext *DC, const Decl *D) {
+ assert(DC->isLookupContext() &&
+ "Should not add lookup results to non-lookup contexts!");
+
// TU is handled elsewhere.
if (isa<TranslationUnitDecl>(DC))
return;
OpenPOWER on IntegriCloud