<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 16, 2015 at 3:30 PM, Vladimir Voskresensky <span dir="ltr"><<a href="mailto:vladimir.voskresensky@oracle.com" target="_blank">vladimir.voskresensky@oracle.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Richard,<br>
    <br>
    Thanks for the quick reply. <br>
    May be you can point me to the code in LLVM where I can find the
    logic I need (find fields which must be implicitly
    created/destroyed)?<br>
    As destructors have to be called for fields, I assume there is such
    logic. <br>
    May be somewhere at AST-of-destructor => IR conversion layer?<br></div></blockquote><div><br></div><div><a href="http://llvm.org/svn/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp">http://llvm.org/svn/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp</a><br></div><div><br></div><div>Search for "EnterDtorCleanups".</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
    Thanks!<span class=""><font color="#888888"><br>
    Vladimir.</font></span><div><div class="h5"><br>
    <br>
    <div>On 03/16/2015 09:46 PM, Richard Smith
      wrote:<br>
    </div>
    <blockquote type="cite">
      <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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style: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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style: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><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" target="_blank">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>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
cfe-dev mailing list
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a>
</pre>
    </blockquote>
    <br>
  </div></div></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>