]> granicus.if.org Git - clang/commitdiff
simplify some code, add support for functions without a proto
authorChris Lattner <sabre@nondot.org>
Sat, 1 Dec 2007 05:58:21 +0000 (05:58 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 1 Dec 2007 05:58:21 +0000 (05:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44485 91177308-0d34-0410-b5e6-96231b3b80d8

AST/Decl.cpp

index b7f85e9a53db9e421f04675b1766edb76edda514..16233b1d8254ba506328377b6c1f4f198b045711 100644 (file)
@@ -242,7 +242,8 @@ FunctionDecl::~FunctionDecl() {
 }
 
 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) {