aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-12-01 05:58:21 +0000
committerChris Lattner <sabre@nondot.org>2007-12-01 05:58:21 +0000
commita977636a9c1edfea2ba36e039e195b80b6e43cdf (patch)
tree1435bfc9363437ea0e040e2bf65bd79f2eb4e70c
parent1438b4918a1658ef6467488109ca434e775e58e5 (diff)
simplify some code, add support for functions without a proto
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44485 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--AST/Decl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/AST/Decl.cpp b/AST/Decl.cpp
index b7f85e9a53..16233b1d82 100644
--- a/AST/Decl.cpp
+++ b/AST/Decl.cpp
@@ -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) {