diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-01-30 01:04:22 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-01-30 01:04:22 +0000 |
| commit | ed8f2887082bbc5c696e7a71217482f9089ce0c2 (patch) | |
| tree | dc2cd940a0fd2a4289b2176c414a8dd7003d6d43 /clang/lib/Sema/SemaDeclObjC.cpp | |
| parent | 199740651ce754663b3d488e0a25eada7153ebcc (diff) | |
| download | bcm5719-llvm-ed8f2887082bbc5c696e7a71217482f9089ce0c2.tar.gz bcm5719-llvm-ed8f2887082bbc5c696e7a71217482f9089ce0c2.zip | |
Eliminated LookupCriteria, whose creation was causing a bottleneck for
LookupName et al. Instead, use an enum and a bool to describe its
contents.
Optimized the C/Objective-C path through LookupName, eliminating any
unnecessarily C++isms. Simplify IdentifierResolver::iterator, removing
some code and arguments that are no longer used.
Eliminated LookupDeclInScope/LookupDeclInContext, moving all callers
over to LookupName, LookupQualifiedName, or LookupParsedName, as
appropriate.
All together, I'm seeing a 0.2% speedup on Cocoa.h with PTH and
-disable-free. Plus, we're down to three name-lookup routines.
llvm-svn: 63354
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 3371e3ea6e2..c3519f8f010 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -64,7 +64,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc, assert(ClassName && "Missing class identifier"); // Check for another declaration kind with the same name. - Decl *PrevDecl = LookupDeclInScope(ClassName, Decl::IDNS_Ordinary, TUScope); + Decl *PrevDecl = LookupName(TUScope, ClassName, LookupOrdinaryName); if (PrevDecl && PrevDecl->isTemplateParameter()) { // Maybe we will complain about the shadowed template parameter. DiagnoseTemplateParameterShadow(ClassLoc, PrevDecl); @@ -107,7 +107,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc, if (SuperName) { ObjCInterfaceDecl* SuperClassEntry = 0; // Check if a different kind of symbol declared in this scope. - PrevDecl = LookupDeclInScope(SuperName, Decl::IDNS_Ordinary, TUScope); + PrevDecl = LookupName(TUScope, SuperName, LookupOrdinaryName); if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) { Diag(SuperLoc, diag::err_redefinition_different_kind) << SuperName; Diag(PrevDecl->getLocation(), diag::note_previous_definition); @@ -149,7 +149,7 @@ Sema::DeclTy *Sema::ActOnCompatiblityAlias(SourceLocation AtLoc, IdentifierInfo *ClassName, SourceLocation ClassLocation) { // Look for previous declaration of alias name - Decl *ADecl = LookupDeclInScope(AliasName, Decl::IDNS_Ordinary, TUScope); + Decl *ADecl = LookupName(TUScope, AliasName, LookupOrdinaryName); if (ADecl) { if (isa<ObjCCompatibleAliasDecl>(ADecl)) Diag(AliasLocation, diag::warn_previous_alias_decl); @@ -159,13 +159,13 @@ Sema::DeclTy *Sema::ActOnCompatiblityAlias(SourceLocation AtLoc, return 0; } // Check for class declaration - Decl *CDeclU = LookupDeclInScope(ClassName, Decl::IDNS_Ordinary, TUScope); + Decl *CDeclU = LookupName(TUScope, ClassName, LookupOrdinaryName); if (const TypedefDecl *TDecl = dyn_cast_or_null<TypedefDecl>(CDeclU)) { QualType T = TDecl->getUnderlyingType(); if (T->isObjCInterfaceType()) { if (NamedDecl *IDecl = T->getAsObjCInterfaceType()->getDecl()) { ClassName = IDecl->getIdentifier(); - CDeclU = LookupDeclInScope(ClassName, Decl::IDNS_Ordinary, TUScope); + CDeclU = LookupName(TUScope, ClassName, LookupOrdinaryName); } } } @@ -535,7 +535,7 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation( SourceLocation SuperClassLoc) { ObjCInterfaceDecl* IDecl = 0; // Check for another declaration kind with the same name. - Decl *PrevDecl = LookupDeclInScope(ClassName, Decl::IDNS_Ordinary, TUScope); + Decl *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); @@ -551,7 +551,7 @@ Sema::DeclTy *Sema::ActOnStartClassImplementation( ObjCInterfaceDecl* SDecl = 0; if (SuperClassname) { // Check if a different kind of symbol declared in this scope. - PrevDecl = LookupDeclInScope(SuperClassname, Decl::IDNS_Ordinary, TUScope); + PrevDecl = LookupName(TUScope, SuperClassname, LookupOrdinaryName); if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) { Diag(SuperClassLoc, diag::err_redefinition_different_kind) << SuperClassname; @@ -909,7 +909,7 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc, for (unsigned i = 0; i != NumElts; ++i) { // Check for another declaration kind with the same name. - Decl *PrevDecl = LookupDeclInScope(IdentList[i], Decl::IDNS_Ordinary, TUScope); + Decl *PrevDecl = LookupName(TUScope, IdentList[i], LookupOrdinaryName); if (PrevDecl && PrevDecl->isTemplateParameter()) { // Maybe we will complain about the shadowed template parameter. DiagnoseTemplateParameterShadow(AtClassLoc, PrevDecl); |

