diff options
author | John McCall <rjmccall@apple.com> | 2009-12-10 09:41:52 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-12-10 09:41:52 +0000 |
commit | 84d8767c1582d1ee300ecf9899b76d57a34c3597 (patch) | |
tree | 1d36caa744cc145503c6493c21da4d1b945b6cea /clang/lib/Sema/TreeTransform.h | |
parent | e919e382a4fa116b3a15cb8855dd928f0ce674a2 (diff) | |
download | bcm5719-llvm-84d8767c1582d1ee300ecf9899b76d57a34c3597.tar.gz bcm5719-llvm-84d8767c1582d1ee300ecf9899b76d57a34c3597.zip |
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
Diffstat (limited to 'clang/lib/Sema/TreeTransform.h')
-rw-r--r-- | clang/lib/Sema/TreeTransform.h | 20 |
1 files changed, 16 insertions, 4 deletions
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<Derived>::TransformUnresolvedLookupExpr( for (UnresolvedLookupExpr::decls_iterator I = Old->decls_begin(), E = Old->decls_end(); I != E; ++I) { NamedDecl *InstD = static_cast<NamedDecl*>(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<UsingShadowDecl>(*I)) + continue; + else + return SemaRef.ExprError(); + } // Expand using declarations. if (isa<UsingDecl>(InstD)) { @@ -4913,8 +4919,14 @@ TreeTransform<Derived>::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old) for (UnresolvedMemberExpr::decls_iterator I = Old->decls_begin(), E = Old->decls_end(); I != E; ++I) { NamedDecl *InstD = static_cast<NamedDecl*>(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<UsingShadowDecl>(*I)) + continue; + else + return SemaRef.ExprError(); + } // Expand using declarations. if (isa<UsingDecl>(InstD)) { |