From 84d8767c1582d1ee300ecf9899b76d57a34c3597 Mon Sep 17 00:00:00 2001 From: John McCall Date: Thu, 10 Dec 2009 09:41:52 +0000 Subject: Implement redeclaration checking and hiding semantics for using declarations. There are a couple of O(n^2) operations in this, some analogous to the usual O(n^2) redeclaration problem and some not. In particular, retroactively removing shadow declarations when they're hidden by later decls is pretty unfortunate. I'm not yet convinced it's worse than the alternative, though. llvm-svn: 91045 --- clang/lib/Sema/TreeTransform.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'clang/lib/Sema/TreeTransform.h') diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 73ca797ce9b..be3c04302e3 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -4506,8 +4506,14 @@ TreeTransform::TransformUnresolvedLookupExpr( for (UnresolvedLookupExpr::decls_iterator I = Old->decls_begin(), E = Old->decls_end(); I != E; ++I) { NamedDecl *InstD = static_cast(getDerived().TransformDecl(*I)); - if (!InstD) - return SemaRef.ExprError(); + if (!InstD) { + // Silently ignore these if a UsingShadowDecl instantiated to nothing. + // This can happen because of dependent hiding. + if (isa(*I)) + continue; + else + return SemaRef.ExprError(); + } // Expand using declarations. if (isa(InstD)) { @@ -4913,8 +4919,14 @@ TreeTransform::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old) for (UnresolvedMemberExpr::decls_iterator I = Old->decls_begin(), E = Old->decls_end(); I != E; ++I) { NamedDecl *InstD = static_cast(getDerived().TransformDecl(*I)); - if (!InstD) - return SemaRef.ExprError(); + if (!InstD) { + // Silently ignore these if a UsingShadowDecl instantiated to nothing. + // This can happen because of dependent hiding. + if (isa(*I)) + continue; + else + return SemaRef.ExprError(); + } // Expand using declarations. if (isa(InstD)) { -- cgit v1.2.3