[cfe-dev] Safe way to identify generated VarDecl's for range-based for loops?

Vane, Edwin edwin.vane at intel.com
Thu Nov 15 07:11:59 PST 2012

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.

Edwin Vane
  Software Developer
  Phone: +1 519 772 2567
  iNET: 87722567

More information about the cfe-dev mailing list