Some name-lookup-related fixes, from Piotr Rak!
- Changes Lookup*Name functions to return NamedDecls, instead of
Decls. Unfortunately my recent statement that it will simplify lot of
code, was not quite right, but it simplifies some...
- Makes MergeLookupResult SmallPtrSet instead of vector, following
Douglas suggestions.
- Adds %qN format for printing qualified names to Diagnostic.
- Avoids searching for using-directives in Scopes, which are not
DeclScope, during unqualified name lookup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63739 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 7c76f16..1e87a6f 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -64,7 +64,7 @@
assert(ClassName && "Missing class identifier");
// Check for another declaration kind with the same name.
- Decl *PrevDecl = LookupName(TUScope, ClassName, LookupOrdinaryName);
+ NamedDecl *PrevDecl = LookupName(TUScope, ClassName, LookupOrdinaryName);
if (PrevDecl && PrevDecl->isTemplateParameter()) {
// Maybe we will complain about the shadowed template parameter.
DiagnoseTemplateParameterShadow(ClassLoc, PrevDecl);
@@ -164,7 +164,7 @@
IdentifierInfo *ClassName,
SourceLocation ClassLocation) {
// Look for previous declaration of alias name
- Decl *ADecl = LookupName(TUScope, AliasName, LookupOrdinaryName);
+ NamedDecl *ADecl = LookupName(TUScope, AliasName, LookupOrdinaryName);
if (ADecl) {
if (isa<ObjCCompatibleAliasDecl>(ADecl))
Diag(AliasLocation, diag::warn_previous_alias_decl);
@@ -174,7 +174,7 @@
return 0;
}
// Check for class declaration
- Decl *CDeclU = LookupName(TUScope, ClassName, LookupOrdinaryName);
+ NamedDecl *CDeclU = LookupName(TUScope, ClassName, LookupOrdinaryName);
if (const TypedefDecl *TDecl = dyn_cast_or_null<TypedefDecl>(CDeclU)) {
QualType T = TDecl->getUnderlyingType();
if (T->isObjCInterfaceType()) {
@@ -550,7 +550,7 @@
SourceLocation SuperClassLoc) {
ObjCInterfaceDecl* IDecl = 0;
// Check for another declaration kind with the same name.
- Decl *PrevDecl = LookupName(TUScope, ClassName, LookupOrdinaryName);
+ NamedDecl *PrevDecl = LookupName(TUScope, ClassName, LookupOrdinaryName);
if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
Diag(ClassLoc, diag::err_redefinition_different_kind) << ClassName;
Diag(PrevDecl->getLocation(), diag::note_previous_definition);
@@ -924,7 +924,7 @@
for (unsigned i = 0; i != NumElts; ++i) {
// Check for another declaration kind with the same name.
- Decl *PrevDecl = LookupName(TUScope, IdentList[i], LookupOrdinaryName);
+ NamedDecl *PrevDecl = LookupName(TUScope, IdentList[i], LookupOrdinaryName);
if (PrevDecl && PrevDecl->isTemplateParameter()) {
// Maybe we will complain about the shadowed template parameter.
DiagnoseTemplateParameterShadow(AtClassLoc, PrevDecl);