diff options
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 2ceea33d07..ce38edd7c5 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -67,21 +67,16 @@ static bool hasFunctionProto(Decl *d) { /// arguments. It is an error to call this on a K&R function (use /// hasFunctionProto first). static unsigned getFunctionOrMethodNumArgs(Decl *d) { - if (const FunctionType *FnTy = getFunctionType(d)) { - const FunctionTypeProto *proto = cast<FunctionTypeProto>(FnTy); - return proto->getNumArgs(); - } else { - return cast<ObjCMethodDecl>(d)->getNumParams(); - } + if (const FunctionType *FnTy = getFunctionType(d)) + return cast<FunctionTypeProto>(FnTy)->getNumArgs(); + return cast<ObjCMethodDecl>(d)->param_size(); } static QualType getFunctionOrMethodArgType(Decl *d, unsigned Idx) { - if (const FunctionType *FnTy = getFunctionType(d)) { - const FunctionTypeProto *proto = cast<FunctionTypeProto>(FnTy); - return proto->getArgType(Idx); - } else { - return cast<ObjCMethodDecl>(d)->getParamDecl(Idx)->getType(); - } + if (const FunctionType *FnTy = getFunctionType(d)) + return cast<FunctionTypeProto>(FnTy)->getArgType(Idx); + + return cast<ObjCMethodDecl>(d)->param_begin()[Idx]->getType(); } static bool isFunctionOrMethodVariadic(Decl *d) { |