[cfe-commits] r45233 - in /cfe/trunk/include/clang/AST: Decl.h DeclObjC.h
Chris Lattner
sabre at nondot.org
Wed Dec 19 15:58:26 PST 2007
Author: lattner
Date: Wed Dec 19 17:58:25 2007
New Revision: 45233
URL: http://llvm.org/viewvc/llvm-project?rev=45233&view=rev
Log:
Add iterator interface to function/method parameters.
Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/include/clang/AST/DeclObjC.h
Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=45233&r1=45232&r2=45233&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Wed Dec 19 17:58:25 2007
@@ -439,6 +439,15 @@
ScopedDecl *getDeclChain() const { return DeclChain; }
void setDeclChain(ScopedDecl *D) { DeclChain = D; }
+ // Iterator access to formal parameters.
+ unsigned param_size() const { return getNumParams(); }
+ typedef ParmVarDecl **param_iterator;
+ typedef ParmVarDecl * const *param_const_iterator;
+ param_iterator param_begin() { return ParamInfo; }
+ param_iterator param_end() { return ParamInfo+param_size(); }
+ param_const_iterator param_begin() const { return ParamInfo; }
+ param_const_iterator param_end() const { return ParamInfo+param_size(); }
+
unsigned getNumParams() const;
const ParmVarDecl *getParamDecl(unsigned i) const {
assert(i < getNumParams() && "Illegal param #");
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=45233&r1=45232&r2=45233&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Wed Dec 19 17:58:25 2007
@@ -118,6 +118,17 @@
Selector getSelector() const { return SelName; }
QualType getResultType() const { return MethodDeclType; }
+ // Iterator access to formal parameters.
+ unsigned param_size() const {
+ return NumMethodParams == -1 ? 0 : NumMethodParams;
+ }
+ typedef ParmVarDecl **param_iterator;
+ typedef ParmVarDecl * const *param_const_iterator;
+ param_iterator param_begin() { return ParamInfo; }
+ param_iterator param_end() { return ParamInfo+param_size(); }
+ param_const_iterator param_begin() const { return ParamInfo; }
+ param_const_iterator param_end() const { return ParamInfo+param_size(); }
+
int getNumParams() const { return NumMethodParams; }
ParmVarDecl *getParamDecl(int i) const {
assert(i < getNumParams() && "Illegal param #");
More information about the cfe-commits
mailing list