]> granicus.if.org Git - clang/commitdiff
with the fixes for better invalid decl/type propagation, this code
authorChris Lattner <sabre@nondot.org>
Sat, 25 Apr 2009 18:38:18 +0000 (18:38 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 25 Apr 2009 18:38:18 +0000 (18:38 +0000)
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

lib/Sema/SemaDecl.cpp

index 914e304557918719f01e8ce241f0d70de04067f0..b048f50c2db718e671e7d68da42ccad02d8d14c0 100644 (file)
@@ -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