[cfe-commits] r61994 - in /cfe/trunk: Driver/ASTConsumers.cpp Driver/RewriteObjC.cpp include/clang/AST/Decl.h include/clang/AST/DeclBase.h include/clang/AST/DeclObjC.h lib/AST/ASTContext.cpp lib/AST/DeclObjC.cpp lib/CodeGen/CGCXX.cpp lib/CodeGen/CGCall.cpp lib/CodeGen/CGObjCGNU.cpp lib/CodeGen/CGObjCMac.cpp lib/CodeGen/CodeGenTypes.cpp lib/Sema/SemaDeclObjC.cpp lib/Sema/SemaExprObjC.cpp lib/Sema/SemaType.cpp
Chris Lattner
clattner at apple.com
Wed Jan 21 22:31:26 PST 2009
On Jan 9, 2009, at 9:18 AM, Douglas Gregor wrote:
> Author: dgregor
> Date: Fri Jan 9 11:18:27 2009
> New Revision: 61994
>
> URL: http://llvm.org/viewvc/llvm-project?rev=61994&view=rev
> Log:
> Provide a new kind of iterator, the specific_decl_iterator, that
> filters the decls seen by decl_iterator with two criteria: the dynamic
> type of the declaration and a run-time predicate described by a member
> function. This simplifies EnumDecl, RecordDecl, and ObjCContainerDecl
> considerably. It has no measurable performance impact.
Very nice!
Two random questions:
> + template<typename SpecificDecl>
> + class specific_decl_iterator {
> + /// Current - The current, underlying declaration iterator, which
> + /// will either be the same as End or will point to a
> declaration of
> + /// type SpecificDecl.
> + DeclContext::decl_iterator Current;
> +
> + /// End - One past the last declaration within the DeclContext.
> + DeclContext::decl_iterator End;
Is there a sentinel that identifies the end of list (e.g. null) which
could be used instead of storing the End iterator here?
> + /// Acceptable - If non-NULL, points to a member function that
> + /// will determine if a particular declaration of type
> + /// SpecificDecl should be visited by the iteration.
> + bool (SpecificDecl::*Acceptable)() const;
Could this be a template argument?
-Chris
More information about the cfe-commits
mailing list