diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-04-24 02:57:34 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-04-24 02:57:34 +0000 |
commit | 516ff43cc4e20b637335d3dfa5b197ca8faa09cb (patch) | |
tree | b416aa0d00ad0c2dcb7b19b00c65d2ae4c03ac53 /lib/Sema/SemaLookup.cpp | |
parent | 7cabee5b18212bd3106aea8415b044b2b3b43518 (diff) |
Eliminate Sema::ObjCAliasDecls. This is based on Steve's fix, but also
updates name lookup so that we see through @compatibility_alias
declarations to their underlying interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69950 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index df869d9a6b..b1643bb50b 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -311,6 +311,10 @@ getIdentifierNamespacesFromLookupNameKind(Sema::LookupNameKind NameKind, Sema::LookupResult Sema::LookupResult::CreateLookupResult(ASTContext &Context, NamedDecl *D) { + if (ObjCCompatibleAliasDecl *Alias + = dyn_cast_or_null<ObjCCompatibleAliasDecl>(D)) + D = Alias->getClassInterface(); + LookupResult Result; Result.StoredKind = (D && isa<OverloadedFunctionDecl>(D))? OverloadedDeclSingleDecl : SingleDecl; @@ -338,9 +342,14 @@ Sema::LookupResult::CreateLookupResult(ASTContext &Context, return Result; } } + + Decl *D = *F; + if (ObjCCompatibleAliasDecl *Alias + = dyn_cast_or_null<ObjCCompatibleAliasDecl>(D)) + D = Alias->getClassInterface(); Result.StoredKind = SingleDecl; - Result.First = reinterpret_cast<uintptr_t>(*F); + Result.First = reinterpret_cast<uintptr_t>(D); Result.Last = 0; return Result; } @@ -362,9 +371,14 @@ Sema::LookupResult::CreateLookupResult(ASTContext &Context, return Result; } } + + Decl *D = *F; + if (ObjCCompatibleAliasDecl *Alias + = dyn_cast_or_null<ObjCCompatibleAliasDecl>(D)) + D = Alias->getClassInterface(); Result.StoredKind = SingleDecl; - Result.First = reinterpret_cast<uintptr_t>(*F); + Result.First = reinterpret_cast<uintptr_t>(D); Result.Last = 0; return Result; } @@ -930,16 +944,6 @@ Sema::LookupName(Scope *S, DeclarationName Name, LookupNameKind NameKind, S, RedeclarationOnly, Loc)); } } - if (getLangOptions().ObjC1 && II) { - // @interface and @compatibility_alias introduce typedef-like names. - // Unlike typedef's, they can only be introduced at file-scope (and are - // therefore not scoped decls). They can, however, be shadowed by - // other names in IDNS_Ordinary. - ObjCAliasTy::iterator I = ObjCAliasDecls.find(II); - if (I != ObjCAliasDecls.end()) - return LookupResult::CreateLookupResult(Context, - I->second->getClassInterface()); - } } return LookupResult::CreateLookupResult(Context, 0); } |