remove some more methods from objc decls, using the iterator
interfaces more consistently.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65138 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 2ceea33..ce38edd 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -67,21 +67,16 @@
/// 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) {