<div>Dear clang developers, greetings!<div>I would like to ask what is the best way to prevent double rewriting of the code; Please consider further example:</div><div> </div><div><div>m_foundPixels.resize(0);</div></div><div> </div></div><div>Where m_foundPixels is class member of "RedPixels" class; Here is the AST dump for it:</div><div> </div><div><div>CXXMemberCallExpr 0x555557a11e40 'void'</div><div>|-MemberExpr 0x555557a11e10 '<bound member function type>' .resize 0x555557597370</div><div>| `-MemberExpr 0x555557a11d60 'std::vector<PixelInfo>':'class std::vector<struct RedPixels::PixelInfoT, struct tinystl::allocator>' lvalue ->m_foundPixels 0x5555577db5a8</div><div>| `-CXXThisExpr 0x555557a11d50 'class RedPixels *' implicit this</div><div>`-ImplicitCastExpr 0x555557a11e68 'size_t':'unsigned long' <IntegralCast></div><div>`-IntegerLiteral 0x555557a11df0 'int'</div><div> </div><div>In my logic i have 2 different rewrites:</div></div><div><div>1) VisitMemberExpr</div><div>2) VisitCXXMemberCallExpr</div></div><div> </div><div>The problems is that for this example VisitMemberExpr is called earlier than VisitCXXMemberCallExpr.</div><div>So if i rewrite the code inside VisitMemberExpr ("m_foundPixels"), my next rewrite in VisitCXXMemberCallExpr (which suppose to rewrite "m_foundPixels.resize(0)") produce incorrect result.</div><div> </div><div><div>I think I can come up with solutions for specific cases, but I would like to know if there is any good general way to prevent such situations.</div><div>For my program logic i suppose that if some upper level of the tree is to be rewritten, we definitely shouldn't touch the lower levels anymore.</div><div> </div><div>Many thanks!</div></div><div>-- </div><div><div>Best Regards,</div><div> Frolov V.A.</div><div> </div></div>