simplify some code, add support for functions without a proto

llvm-svn: 44485
diff --git a/clang/AST/Decl.cpp b/clang/AST/Decl.cpp
index b7f85e9..16233b1 100644
--- a/clang/AST/Decl.cpp
+++ b/clang/AST/Decl.cpp
@@ -242,7 +242,8 @@
 }
 
 unsigned FunctionDecl::getNumParams() const {
-  return cast<FunctionTypeProto>(getType().getTypePtr())->getNumArgs();
+  if (isa<FunctionTypeNoProto>(getType())) return 0;
+  return cast<FunctionTypeProto>(getType())->getNumArgs();
 }
 
 void FunctionDecl::setParams(ParmVarDecl **NewParamInfo, unsigned NumParams) {