diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-25 18:38:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-25 18:38:18 +0000 |
commit | 84bb944dee0cc102635b162c669f99c529c60c02 (patch) | |
tree | 2a795dbb39f8ff4be146cc0de0b972ae4244b181 /lib/Sema/SemaDecl.cpp | |
parent | 8f5dc7fe4d42cea78fa92d1638f753cf65b54cb5 (diff) |
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
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 25 |
1 files changed, 4 insertions, 21 deletions
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 |