Don't look up decls with no name (such as parameters and unnamed tagged types),

this removes 4266 calls to LookupDecl.

llvm-svn: 62662
This commit is contained in:
Chris Lattner 2009-01-21 02:38:50 +00:00
parent 201501995f
commit d9773516e7
1 changed files with 15 additions and 13 deletions

View File

@ -2564,6 +2564,7 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
// Can this happen for params? We already checked that they don't conflict
// among each other. Here they can only shadow globals, which is ok.
IdentifierInfo *II = D.getIdentifier();
if (II) {
if (Decl *PrevDecl = LookupDecl(II, Decl::IDNS_Ordinary, S)) {
if (PrevDecl->isTemplateParameter()) {
// Maybe we will complain about the shadowed template parameter.
@ -2578,6 +2579,7 @@ Sema::ActOnParamDeclarator(Scope *S, Declarator &D) {
D.SetIdentifier(0, D.getIdentifierLoc());
}
}
}
// Perform the default function/array conversion (C99 6.7.5.3p[7,8]).
// Doing the promotion here has a win and a loss. The win is the type for
@ -2855,7 +2857,7 @@ Sema::DeclTy *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagKind TK,
Name = 0;
goto CreateNewDecl;
}
} else {
} else if (Name) {
// If this is a named struct, check to see if there was a previous forward
// declaration or definition.
PrevDecl = dyn_cast_or_null<NamedDecl>(LookupDecl(Name, Decl::IDNS_Tag,S)