summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-04 17:00:24 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-04 17:00:24 +0000
commit8a6be5ec640dbaa76b727979fb39f0d18879488e (patch)
tree4cc88141a8ca87ef32062ee5834ec479690699c4 /clang/lib/Sema
parentffee3d831ac0d3e0c191a87a9f829c85e4baa698 (diff)
downloadbcm5719-llvm-8a6be5ec640dbaa76b727979fb39f0d18879488e.tar.gz
bcm5719-llvm-8a6be5ec640dbaa76b727979fb39f0d18879488e.zip
Diagnose ambiguities in getTypeName. Fixes http://llvm.org/bugs/show_bug.cgi?id=3475
llvm-svn: 63737
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/Sema.h4
-rw-r--r--clang/lib/Sema/SemaDecl.cpp12
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp2
3 files changed, 9 insertions, 9 deletions
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h
index 724a57ed42b..9810ba0cb57 100644
--- a/clang/lib/Sema/Sema.h
+++ b/clang/lib/Sema/Sema.h
@@ -281,8 +281,8 @@ public:
//===--------------------------------------------------------------------===//
// Symbol table / Decl tracking callbacks: SemaDecl.cpp.
//
- virtual TypeTy *getTypeName(IdentifierInfo &II, Scope *S,
- const CXXScopeSpec *SS);
+ virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc,
+ Scope *S, const CXXScopeSpec *SS);
virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup) {
return ActOnDeclarator(S, D, LastInGroup, false);
}
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;
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 201d8b3ca86..2175ad3b936 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -691,7 +691,7 @@ Sema::ActOnMemInitializer(DeclTy *ConstructorD,
}
// It didn't name a member, so see if it names a class.
- TypeTy *BaseTy = getTypeName(*MemberOrBase, S, 0/*SS*/);
+ TypeTy *BaseTy = getTypeName(*MemberOrBase, IdLoc, S, 0/*SS*/);
if (!BaseTy)
return Diag(IdLoc, diag::err_mem_init_not_member_or_class)
<< MemberOrBase << SourceRange(IdLoc, RParenLoc);
OpenPOWER on IntegriCloud