summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-25 06:03:53 +0000
committerChris Lattner <sabre@nondot.org>2009-04-25 06:03:53 +0000
commit47c0d00c3fb6a845dc305fd5279b244be625d1fe (patch)
treed3480e8146b8f11194513b8ed53f72fad20ad3bd /clang/lib/AST/Decl.cpp
parentdfd637f2047f634136efd3bf1739ff4558017aa0 (diff)
downloadbcm5719-llvm-47c0d00c3fb6a845dc305fd5279b244be625d1fe.tar.gz
bcm5719-llvm-47c0d00c3fb6a845dc305fd5279b244be625d1fe.zip
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. llvm-svn: 70015
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index a715531c74a..57a44e54d8b 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud