aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaLookup.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-12-10 09:41:52 +0000
committerJohn McCall <rjmccall@apple.com>2009-12-10 09:41:52 +0000
commit9f54ad4381370c6b771424b53d219e661d6d6706 (patch)
treecf7e1c1bceaefab55c52fa3458005811e59d0185 /lib/Sema/SemaLookup.cpp
parent153c33ed957b135a366178c61bbe22b6b1362a2a (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91045 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r--lib/Sema/SemaLookup.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp
index 48d7320d2e..66c846b078 100644
--- a/lib/Sema/SemaLookup.cpp
+++ b/lib/Sema/SemaLookup.cpp
@@ -222,6 +222,11 @@ getIdentifierNamespacesFromLookupNameKind(Sema::LookupNameKind NameKind,
IDNS = Decl::IDNS_Ordinary | Decl::IDNS_Tag | Decl::IDNS_Member;
break;
+ case Sema::LookupUsingDeclName:
+ IDNS = Decl::IDNS_Ordinary | Decl::IDNS_Tag
+ | Decl::IDNS_Member | Decl::IDNS_Using;
+ break;
+
case Sema::LookupObjCProtocolName:
IDNS = Decl::IDNS_ObjCProtocol;
break;
@@ -245,7 +250,7 @@ void LookupResult::deletePaths(CXXBasePaths *Paths) {
/// Resolves the result kind of this lookup.
void LookupResult::resolveKind() {
unsigned N = Decls.size();
-
+
// Fast case: no possible ambiguity.
if (N == 0) {
assert(ResultKind == NotFound);
@@ -613,6 +618,7 @@ bool Sema::LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation) {
case Sema::LookupOperatorName:
case Sema::LookupNestedNameSpecifierName:
case Sema::LookupNamespaceName:
+ case Sema::LookupUsingDeclName:
assert(false && "C does not perform these kinds of name lookup");
break;
@@ -928,6 +934,9 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx) {
case LookupTagName:
BaseCallback = &CXXRecordDecl::FindTagMember;
break;
+
+ case LookupUsingDeclName:
+ // This lookup is for redeclarations only.
case LookupOperatorName:
case LookupNamespaceName: