Safe way to identify generated VarDecl's for range-based for loops?

Hi all,

Just wondering what the best way to identify the VarDecl's created for a range-based for loop (i.e. the ones called __begin, __end, and __range). There doesn't seem to be any special flag but they all have the attribute of having a start and end SourceLocation that are the same. Really I'm trying to identify the VarDecl the user actual wrote in code so I want to filter out the auto-generated ones.

I'm aware of isCXXForRangeDecl() but this bit of code I'm working on will be handling all kinds of user-written VarDecl's where this function will return false.

Probably VD->isImplicit(). Implicit bit is set in SemaStmt.cpp,
BuildForRangeVarDecl().

Dmitri