diff options
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 15 | ||||
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 3 | ||||
-rw-r--r-- | lib/Sema/SemaObjCProperty.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 4 |
7 files changed, 18 insertions, 16 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index a9c1ec1cd6..bee542234b 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -8514,7 +8514,7 @@ CreateNewDecl: New->setAccess(PrevDecl->getAccess()); DeclContext *DC = New->getDeclContext()->getRedeclContext(); - DC->makeDeclVisibleInContext(New, /* Recoverable = */ false); + DC->makeDeclVisibleInContext(New); if (Name) // can be null along some error paths if (Scope *EnclosingScope = getScopeForDeclContext(S, DC)) PushOnScopeChains(New, EnclosingScope, /* AddToContext = */ false); @@ -8522,7 +8522,7 @@ CreateNewDecl: S = getNonFieldDeclScope(S); PushOnScopeChains(New, S, !IsForwardReference); if (IsForwardReference) - SearchDC->makeDeclVisibleInContext(New, /* Recoverable = */ false); + SearchDC->makeDeclVisibleInContext(New); } else { CurContext->addDecl(New); diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index abbbe11561..b6866d04e4 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -5829,14 +5829,15 @@ Decl *Sema::ActOnUsingDirective(Scope *S, } void Sema::PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir) { - // If scope has associated entity, then using directive is at namespace - // or translation unit scope. We add UsingDirectiveDecls, into - // it's lookup structure. - if (DeclContext *Ctx = static_cast<DeclContext*>(S->getEntity())) + // If the scope has an associated entity and the using directive is at + // namespace or translation unit scope, add the UsingDirectiveDecl into + // its lookup structure so qualified name lookup can find it. + DeclContext *Ctx = static_cast<DeclContext*>(S->getEntity()); + if (Ctx && !Ctx->isFunctionOrMethod()) Ctx->addDecl(UDir); else - // Otherwise it is block-sope. using-directives will affect lookup - // only to the end of scope. + // Otherwise, it is at block sope. The using-directives will affect lookup + // only to the end of the scope. S->PushUsingDirective(UDir); } @@ -10195,7 +10196,7 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, // lookup context is in lexical scope. if (!CurContext->isDependentContext()) { DC = DC->getRedeclContext(); - DC->makeDeclVisibleInContext(ND, /* Recoverable=*/ false); + DC->makeDeclVisibleInContext(ND); if (Scope *EnclosingScope = getScopeForDeclContext(S, DC)) PushOnScopeChains(ND, EnclosingScope, /*AddToContext=*/ false); } diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index d224f1058a..268ab368ce 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -1026,7 +1026,7 @@ void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, // Add ivar's to class's DeclContext. for (unsigned i = 0, e = numIvars; i != e; ++i) { ivars[i]->setLexicalDeclContext(ImpDecl); - IDecl->makeDeclVisibleInContext(ivars[i], false); + IDecl->makeDeclVisibleInContext(ivars[i]); ImpDecl->addDecl(ivars[i]); } @@ -1050,7 +1050,7 @@ void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, } // Instance ivar to Implementation's DeclContext. ImplIvar->setLexicalDeclContext(ImpDecl); - IDecl->makeDeclVisibleInContext(ImplIvar, false); + IDecl->makeDeclVisibleInContext(ImplIvar); ImpDecl->addDecl(ImplIvar); } return; diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index f1eb522415..fbb0dc6b0f 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -106,7 +106,8 @@ namespace { assert(InnermostFileDC && InnermostFileDC->isFileContext()); for (; S; S = S->getParent()) { - if (DeclContext *Ctx = static_cast<DeclContext*>(S->getEntity())) { + DeclContext *Ctx = static_cast<DeclContext*>(S->getEntity()); + if (Ctx && !Ctx->isFunctionOrMethod()) { DeclContext *EffectiveDC = (Ctx->isFileContext() ? Ctx : InnermostFileDC); visit(Ctx, EffectiveDC); } else { diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index 5c28db4c5e..5ece8f11e7 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -740,7 +740,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, ObjCIvarDecl::Private, (Expr *)0, true); ClassImpDecl->addDecl(Ivar); - IDecl->makeDeclVisibleInContext(Ivar, false); + IDecl->makeDeclVisibleInContext(Ivar); property->setPropertyIvarDecl(Ivar); if (!getLangOpts().ObjCNonFragileABI) diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index af6b319e90..e76a253869 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -1088,7 +1088,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, // Friend templates are visible in fairly strange ways. if (!CurContext->isDependentContext()) { DeclContext *DC = SemanticContext->getRedeclContext(); - DC->makeDeclVisibleInContext(NewTemplate, /* Recoverable = */ false); + DC->makeDeclVisibleInContext(NewTemplate); if (Scope *EnclosingScope = getScopeForDeclContext(S, DC)) PushOnScopeChains(NewTemplate, EnclosingScope, /* AddToContext = */ false); diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 56ce50e592..f10670c47a 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -817,7 +817,7 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) { // Finish handling of friends. if (isFriend) { - DC->makeDeclVisibleInContext(Inst, /*Recoverable*/ false); + DC->makeDeclVisibleInContext(Inst); Inst->setLexicalDeclContext(Owner); RecordInst->setLexicalDeclContext(Owner); return Inst; @@ -1189,7 +1189,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, PrevDecl = Function->getPreviousDecl(); PrincipalDecl->setObjectOfFriendDecl(PrevDecl != 0); - DC->makeDeclVisibleInContext(PrincipalDecl, /*Recoverable=*/ false); + DC->makeDeclVisibleInContext(PrincipalDecl); bool queuedInstantiation = false; |