<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 16, 2015 at 7:31 AM, Vladimir Voskresensky <span dir="ltr"><<a href="mailto:voskresensky.vladimir@gmail.com" target="_blank">voskresensky.vladimir@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hello,<br><br>How can I find by AST visitor for which fields destructors are called?<br><br>for the following code:<br>  struct WithDestr {<br>    int *i;<br><br>    WithDestr() : i(nullptr) { }<br><br>    virtual ~WithDestr() { delete i; }<br>  };<br><br>  struct Other {<br>    WithDestr d;<br>    long *ptr;<br>    Other() { }<br>    virtual ~Other() { delete ptr; }<br>  };<br><br></div>In AST I see only the construction of field d, but do not see anywhere destruction of d.<br></div></div></blockquote><div><br></div><div>We do not model the implicit member and base destruction actions performed by a destructor in the AST.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>|-CXXRecordDecl 0x9130050 <line:13:3, line:18:3> line:13:10 struct Other definition<br>| |-CXXRecordDecl 0x9130100 <col:3, col:10> col:10 implicit referenced struct Other<br>| |-FieldDecl 0x9130160 <line:14:5, col:15> col:15 d 'struct WithDestr'<br>| |-FieldDecl 0x91301c0 <line:15:5, col:11> col:11 referenced ptr 'long * '<br>| |-CXXConstructorDecl 0x9130240 <line:16:5, col:15> col:5 Other 'void (void) __attribute__((cdecl))'<br>| | |-CXXCtorInitializer Field 0x9130160 'd' 'struct WithDestr'<br>| | | `-CXXConstructExpr 0x9176ae8 <col:5> 'struct WithDestr' 'void (void) __attribute__((cdecl))'<br>| | `-CompoundStmt 0x9176b30 <col:13, col:15><br>| |-CXXDestructorDecl 0x9176850 <line:17:5, col:36> col:13 used ~Other 'void (void) __attribute__((cdecl)) noexcept' virtual<br>| | `-CompoundStmt 0x9176b98 <col:22, col:36><br>| |   `-CXXDeleteExpr 0x9176b80 <col:24, col:31> 'void'<br>| |     `-ImplicitCastExpr 0x9176b70 <col:31> 'long * ' <LValueToRValue><br>| |       `-MemberExpr 0x9176b50 <col:31> 'long * ' lvalue ->ptr 0x91301c0<br>| |         `-CXXThisExpr 0x9176b40 <col:31> 'struct Other * ' this<br><br><br><br></div>Thanks!<span class="HOEnZb"><font color="#888888"><br><div>Vladimir.<br></div></font></span></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>