diff options
author | John McCall <rjmccall@apple.com> | 2009-10-09 21:13:30 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-10-09 21:13:30 +0000 |
commit | f36e02d4aff98bf2e52e342e0038d4172fbb5e64 (patch) | |
tree | de0e84cc5c69c3749a01794221565dcbe5d22614 /lib/Sema/SemaDeclObjC.cpp | |
parent | d7e5bdb23c6ba2786cf94788c9af555e2c1276ce (diff) |
Refactor the LookupResult API to simplify most common operations. Require users to
pass a LookupResult reference to lookup routines. Call out uses which assume a single
result.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83674 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 8a69a861c4..22a517934c 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -84,7 +84,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc, assert(ClassName && "Missing class identifier"); // Check for another declaration kind with the same name. - NamedDecl *PrevDecl = LookupName(TUScope, ClassName, LookupOrdinaryName); + NamedDecl *PrevDecl = LookupSingleName(TUScope, ClassName, LookupOrdinaryName); if (PrevDecl && PrevDecl->isTemplateParameter()) { // Maybe we will complain about the shadowed template parameter. DiagnoseTemplateParameterShadow(ClassLoc, PrevDecl); @@ -124,7 +124,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc, if (SuperName) { // Check if a different kind of symbol declared in this scope. - PrevDecl = LookupName(TUScope, SuperName, LookupOrdinaryName); + PrevDecl = LookupSingleName(TUScope, SuperName, LookupOrdinaryName); if (PrevDecl == IDecl) { Diag(SuperLoc, diag::err_recursive_superclass) << SuperName << ClassName << SourceRange(AtInterfaceLoc, ClassLoc); @@ -195,7 +195,7 @@ Sema::DeclPtrTy Sema::ActOnCompatiblityAlias(SourceLocation AtLoc, IdentifierInfo *ClassName, SourceLocation ClassLocation) { // Look for previous declaration of alias name - NamedDecl *ADecl = LookupName(TUScope, AliasName, LookupOrdinaryName); + NamedDecl *ADecl = LookupSingleName(TUScope, AliasName, LookupOrdinaryName); if (ADecl) { if (isa<ObjCCompatibleAliasDecl>(ADecl)) Diag(AliasLocation, diag::warn_previous_alias_decl); @@ -205,13 +205,13 @@ Sema::DeclPtrTy Sema::ActOnCompatiblityAlias(SourceLocation AtLoc, return DeclPtrTy(); } // Check for class declaration - NamedDecl *CDeclU = LookupName(TUScope, ClassName, LookupOrdinaryName); + NamedDecl *CDeclU = LookupSingleName(TUScope, ClassName, LookupOrdinaryName); if (const TypedefDecl *TDecl = dyn_cast_or_null<TypedefDecl>(CDeclU)) { QualType T = TDecl->getUnderlyingType(); if (T->isObjCInterfaceType()) { if (NamedDecl *IDecl = T->getAs<ObjCInterfaceType>()->getDecl()) { ClassName = IDecl->getIdentifier(); - CDeclU = LookupName(TUScope, ClassName, LookupOrdinaryName); + CDeclU = LookupSingleName(TUScope, ClassName, LookupOrdinaryName); } } } @@ -654,7 +654,8 @@ Sema::DeclPtrTy Sema::ActOnStartClassImplementation( SourceLocation SuperClassLoc) { ObjCInterfaceDecl* IDecl = 0; // Check for another declaration kind with the same name. - NamedDecl *PrevDecl = LookupName(TUScope, ClassName, LookupOrdinaryName); + NamedDecl *PrevDecl + = LookupSingleName(TUScope, ClassName, LookupOrdinaryName); if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) { Diag(ClassLoc, diag::err_redefinition_different_kind) << ClassName; Diag(PrevDecl->getLocation(), diag::note_previous_definition); @@ -671,7 +672,7 @@ Sema::DeclPtrTy Sema::ActOnStartClassImplementation( ObjCInterfaceDecl* SDecl = 0; if (SuperClassname) { // Check if a different kind of symbol declared in this scope. - PrevDecl = LookupName(TUScope, SuperClassname, LookupOrdinaryName); + PrevDecl = LookupSingleName(TUScope, SuperClassname, LookupOrdinaryName); if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) { Diag(SuperClassLoc, diag::err_redefinition_different_kind) << SuperClassname; @@ -1121,7 +1122,8 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc, for (unsigned i = 0; i != NumElts; ++i) { // Check for another declaration kind with the same name. - NamedDecl *PrevDecl = LookupName(TUScope, IdentList[i], LookupOrdinaryName); + NamedDecl *PrevDecl + = LookupSingleName(TUScope, IdentList[i], LookupOrdinaryName); if (PrevDecl && PrevDecl->isTemplateParameter()) { // Maybe we will complain about the shadowed template parameter. DiagnoseTemplateParameterShadow(AtClassLoc, PrevDecl); |