[cfe-commits] r70060 - /cfe/trunk/lib/Sema/SemaDecl.cpp

Chris Lattner sabre at nondot.org
Sat Apr 25 11:38:19 PDT 2009


Author: lattner
Date: Sat Apr 25 13:38:18 2009
New Revision: 70060

URL: http://llvm.org/viewvc/llvm-project?rev=70060&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=70060&r1=70059&r2=70060&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Apr 25 13:38:18 2009
@@ -2164,30 +2164,13 @@
       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





More information about the cfe-commits mailing list