[cfe-dev] Safe way to identify generated VarDecl's for range-based for loops?
Dmitri Gribenko
gribozavr at gmail.com
Thu Nov 15 07:22:46 PST 2012
On Thu, Nov 15, 2012 at 5:11 PM, Vane, Edwin <edwin.vane at intel.com> wrote:
> 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.
Probably VD->isImplicit(). Implicit bit is set in SemaStmt.cpp,
BuildForRangeVarDecl().
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the cfe-dev
mailing list