From: Anders Carlsson Date: Sat, 18 Apr 2009 20:18:04 +0000 (+0000) Subject: Add functions for iterating over the argument types of an ObjCMethodDecl. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6ea8e2152e1ba93b4c80e7268403a582896dc3dc;p=clang Add functions for iterating over the argument types of an ObjCMethodDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69468 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index 7b02bb29fd..2f360b6db5 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -15,6 +15,7 @@ #define LLVM_CLANG_AST_DECLOBJC_H #include "clang/AST/Decl.h" +#include "llvm/ADT/STLExtras.h" namespace clang { class Expr; @@ -200,6 +201,17 @@ public: ParamInfo.set(List, Num, C); } + // Iterator access to parameter types. + typedef std::const_mem_fun_t deref_fun; + typedef llvm::mapped_iterator arg_type_iterator; + + arg_type_iterator arg_type_begin() const { + return llvm::map_iterator(param_begin(), deref_fun(&ParmVarDecl::getType)); + } + arg_type_iterator arg_type_end() const { + return llvm::map_iterator(param_end(), deref_fun(&ParmVarDecl::getType)); + } + /// createImplicitParams - Used to lazily create the self and cmd /// implict parameters. This must be called prior to using getSelfDecl() /// or getCmdDecl(). The call is ignored if the implicit paramters