]> granicus.if.org Git - clang/commitdiff
Add functions for iterating over the argument types of an ObjCMethodDecl.
authorAnders Carlsson <andersca@mac.com>
Sat, 18 Apr 2009 20:18:04 +0000 (20:18 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 18 Apr 2009 20:18:04 +0000 (20:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69468 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclObjC.h

index 7b02bb29fd4e17b2412a553fda1b892b28c1f5e2..2f360b6db5b1c025dd57744d2a538be4fed79407 100644 (file)
@@ -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<QualType, ParmVarDecl> deref_fun;
+  typedef llvm::mapped_iterator<param_iterator, deref_fun> 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