diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-25 06:03:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-25 06:03:53 +0000 |
commit | 1ad9b28e3217c2349a04f3d3bf14f9c73a99afa7 (patch) | |
tree | ffdc08bb7cee5a8da948446790ee8f57c411a638 /lib/AST/Decl.cpp | |
parent | 11ddb7dc22bb398a6727318729680630bfcefaae (diff) |
rename getNumParmVarDeclsFromType back to getNumParams(),
remove a special case that was apparently for typeof() and
generalize the code in SemaDecl that handles typedefs to
handle any sugar type (including typedef, typeof, etc).
Improve comment to make it more clear what is going on.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70015 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index a715531c74..57a44e54d8 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -431,10 +431,10 @@ unsigned FunctionDecl::getBuiltinID(ASTContext &Context) const { } -/// getNumParmVarDeclsFromType - Ignoring the actual argument list, this -/// returns the number of ParmVarDecls that the FunctionType of this function -/// expects. -unsigned FunctionDecl::getNumParmVarDeclsFromType() const { +/// getNumParams - Return the number of parameters this function must have +/// based on its functiontype. This is the length of the PararmInfo array +/// after it has been created. +unsigned FunctionDecl::getNumParams() const { const FunctionType *FT = getType()->getAsFunctionType(); if (isa<FunctionNoProtoType>(FT)) return 0; @@ -442,18 +442,10 @@ unsigned FunctionDecl::getNumParmVarDeclsFromType() const { } -unsigned FunctionDecl::getNumParams() const { - // Can happen if a FunctionDecl is declared using typeof(some_other_func) bar; - if (!ParamInfo) - return 0; - - return getNumParmVarDeclsFromType(); -} - void FunctionDecl::setParams(ASTContext& C, ParmVarDecl **NewParamInfo, unsigned NumParams) { assert(ParamInfo == 0 && "Already has param info!"); - assert(NumParams == getNumParmVarDeclsFromType() && + assert(NumParams == getNumParams() && "Parameter count mismatch!"); // Zero params -> null pointer. |