From: Chris Lattner Date: Sat, 25 Apr 2009 18:38:18 +0000 (+0000) Subject: with the fixes for better invalid decl/type propagation, this code X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=84bb944dee0cc102635b162c669f99c529c60c02;p=clang with the fixes for better invalid decl/type propagation, this code is no longer needed: a function type and a function declarator are always known to line up. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70060 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 914e304557..b048f50c2d 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2164,30 +2164,13 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, Param->setImplicit(); Params.push_back(Param); } + } else { + assert(R->isFunctionNoProtoType() && NewFD->getNumParams() == 0 && + "Should not need args for typedef of non-prototype fn"); } - - // If NewFD is invalid, then the Params list may not have the right number of - // decls for this FunctionDecl. Because we want the AST to be as correct as - // possible, "fix" these problems by removing or adding params as needed. - if (NewFD->isInvalidDecl()) { - unsigned NumNeededParams = NewFD->getNumParams(); - while (NumNeededParams > Params.size()) { - ParmVarDecl *Param = ParmVarDecl::Create(Context, DC, - SourceLocation(), 0, - Context.IntTy, VarDecl::None, 0); - Param->setImplicit(); - Param->setInvalidDecl(); - Params.push_back(Param); - } - - while (NumNeededParams < Params.size()) { - Params.pop_back(); - // FIXME: Don't leak the decl. - } - } - // Finally, we know we have the right number of parameters, install them. NewFD->setParams(Context, &Params[0], Params.size()); + // If name lookup finds a previous declaration that is not in the