diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-01-15 00:26:24 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-01-15 00:26:24 +0000 |
commit | 7176fff961e04c4dff61efb967b1d344d41335a7 (patch) | |
tree | be2a2c2cb416b04178488b32155e7085a4aced9d /lib/Sema/SemaDecl.cpp | |
parent | 89db21fec845257482c8cdd3544bb2a9c1daf8e0 (diff) |
Initial implementation of member name lookup
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62247 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 5119388dbc..468e95523c 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -39,12 +39,28 @@ Sema::TypeTy *Sema::isTypeName(IdentifierInfo &II, Scope *S, return 0; DC = static_cast<DeclContext*>(SS->getScopeRep()); } - Decl *IIDecl = LookupDecl(&II, Decl::IDNS_Ordinary, S, DC, false); + LookupResult Result = LookupDecl(&II, Decl::IDNS_Ordinary, S, DC, false); + + Decl *IIDecl = 0; + switch (Result.getKind()) { + case LookupResult::NotFound: + case LookupResult::FoundOverloaded: + case LookupResult::AmbiguousBaseSubobjectTypes: + case LookupResult::AmbiguousBaseSubobjects: + // FIXME: In the event of an ambiguous lookup, we could visit all of + // the entities found to determine whether they are all types. This + // might provide better diagnostics. + return 0; + + case LookupResult::Found: + IIDecl = Result.getAsDecl(); + break; + } - if (IIDecl && (isa<TypedefDecl>(IIDecl) || - isa<ObjCInterfaceDecl>(IIDecl) || - isa<TagDecl>(IIDecl) || - isa<TemplateTypeParmDecl>(IIDecl))) + if (isa<TypedefDecl>(IIDecl) || + isa<ObjCInterfaceDecl>(IIDecl) || + isa<TagDecl>(IIDecl) || + isa<TemplateTypeParmDecl>(IIDecl)) return IIDecl; return 0; } |