From 8a6be5ec640dbaa76b727979fb39f0d18879488e Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 4 Feb 2009 17:00:24 +0000 Subject: Diagnose ambiguities in getTypeName. Fixes http://llvm.org/bugs/show_bug.cgi?id=3475 llvm-svn: 63737 --- clang/lib/Sema/SemaDecl.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'clang/lib/Sema/SemaDecl.cpp') diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 66b72ecad4f..fbf4be79eb5 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -30,21 +30,21 @@ using namespace clang; -Sema::TypeTy *Sema::getTypeName(IdentifierInfo &II, Scope *S, - const CXXScopeSpec *SS) { +Sema::TypeTy *Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc, + Scope *S, const CXXScopeSpec *SS) { Decl *IIDecl = 0; LookupResult Result = LookupParsedName(S, SS, &II, LookupOrdinaryName, false); switch (Result.getKind()) { case LookupResult::NotFound: case LookupResult::FoundOverloaded: + return 0; + 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. case LookupResult::AmbiguousReference: - // FIXME: We need source location of identifier to diagnose more correctly. + DiagnoseAmbiguousLookup(Result, DeclarationName(&II), NameLoc); return 0; + case LookupResult::Found: IIDecl = Result.getAsDecl(); break; -- cgit v1.2.3