<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">If you’re still having an issue, can you provide a link to the actual code generating that dump? I’m not sure what those line numbers refer into.<br class=""><div><br class=""></div><div>From your dump it seems as if you called the destructor explicitly in the constructor body for some reason. Perhaps what was intended to be a destructor declaration instead made it into constructor body, due to a misplaced closing brace, thus appearing as a destructor call? Maybe caused by macro wizardry gone awry? Hard to say for sure without seeing the original code.</div><div><br class=""></div><div>The reduced code you reference below dumps as expected for me; there is no CXXMemberCallExpr anywhere. Specifically:</div><div><br class=""></div><div>```</div><div><div liberation="" mono",="" courier,="" monospace',="" menlo,="" monaco,="" 'courier="" new',="" monospace;font-weight:="" normal;font-size:="" 14px;line-height:="" 21px;white-space:="" pre;"="" style="background-color: rgb(255, 255, 254);" class=""><div class=""><font size="1" class=""><font face="Menlo" class=""><span style="color: rgb(0, 0, 255);" class="">class</span> ColorTag </font><span style="font-family: Menlo;" class="">{</span></font></div><div class=""><font face="Menlo" size="1" class=""><span style="color: rgb(0, 0, 255);" class="">public</span>:</font></div><div class=""><font face="Menlo" size="1" class=""> ColorTag();</font></div><div class=""><font face="Menlo" size="1" class=""> ~ColorTag();</font></div><div class=""><font face="Menlo" size="1" class="">};</font></div><div class=""><font size="1" class=""><font face="Menlo" class="">ColorTag::ColorTag() {</font></font></div><div class=""><font size="1" class=""><span style="font-family: Menlo;" class=""> //...</span></font></div><div class=""><font size="1" class=""><span style="font-family: Menlo;" class="">}</span></font></div><div class=""><font face="Menlo" size="1" class="">ColorTag::~ColorTag() {}</font></div></div></div><div>```</div><div><br class=""></div><div>dumps to:</div><div><br class=""></div><div>```</div><div><div liberation="" mono",="" courier,="" monospace',="" menlo,="" monaco,="" 'courier="" new',="" monospace;font-weight:="" normal;font-size:="" 14px;line-height:="" 21px;white-space:="" pre;"="" style="background-color: rgb(255, 255, 254);" class=""><div class=""><font face="Menlo" size="1" class="">TranslationUnitDecl</font></div><div class=""><font face="Menlo" size="1" class="">|-CXXRecordDecl <line:<span style="color: rgb(9, 134, 88);" class="">2</span>:<span style="color: rgb(9, 134, 88);" class="">1</span>, line:<span style="color: rgb(9, 134, 88);" class="">7</span>:<span style="color: rgb(9, 134, 88);" class="">1</span>> line:<span style="color: rgb(9, 134, 88);" class="">2</span>:<span style="color: rgb(9, 134, 88);" class="">7</span> <span style="color: rgb(0, 0, 255);" class="">class</span> ColorTag definition</font></div><div class=""><font face="Menlo" size="1" class="">| |-DefinitionData empty standard_layout has_user_declared_ctor can_const_default_init</font></div><div class=""><font face="Menlo" size="1" class="">| | |-DefaultConstructor exists non_trivial user_provided defaulted_is_constexpr</font></div><div class=""><font face="Menlo" size="1" class="">| | |-CopyConstructor simple trivial has_const_param implicit_has_const_param</font></div><div class=""><font face="Menlo" size="1" class="">| | |-MoveConstructor</font></div><div class=""><font face="Menlo" size="1" class="">| | |-CopyAssignment trivial has_const_param needs_implicit implicit_has_const_param</font></div><div class=""><font face="Menlo" size="1" class="">| | |-MoveAssignment</font></div><div class=""><font face="Menlo" size="1" class="">| | `-Destructor non_trivial user_declared</font></div><div class=""><font face="Menlo" size="1" class="">| |-CXXRecordDecl <col:<span style="color: rgb(9, 134, 88);" class="">1</span>, col:<span style="color: rgb(9, 134, 88);" class="">7</span>> col:<span style="color: rgb(9, 134, 88);" class="">7</span> implicit referenced <span style="color: rgb(0, 0, 255);" class="">class</span> ColorTag</font></div><div class=""><font face="Menlo" size="1" class="">| |-AccessSpecDecl <line:<span style="color: rgb(9, 134, 88);" class="">4</span>:<span style="color: rgb(9, 134, 88);" class="">1</span>, col:<span style="color: rgb(9, 134, 88);" class="">7</span>> col:<span style="color: rgb(9, 134, 88);" class="">1</span> <span style="color: rgb(0, 0, 255);" class="">public</span></font></div><div class=""><font face="Menlo" size="1" class="">| |-CXXConstructorDecl <line:<span style="color: rgb(9, 134, 88);" class="">5</span>:<span style="color: rgb(9, 134, 88);" class="">4</span>, col:<span style="color: rgb(9, 134, 88);" class="">13</span>> col:<span style="color: rgb(9, 134, 88);" class="">4</span> ColorTag <span style="color: rgb(163, 21, 21);" class="">'</span><span style="color: rgb(0, 0, 255);" class="">void</span> ()<span style="color: rgb(163, 21, 21);" class="">'</span></font></div><div class=""><font face="Menlo" size="1" class="">| |-CXXDestructorDecl <line:<span style="color: rgb(9, 134, 88);" class="">6</span>:<span style="color: rgb(9, 134, 88);" class="">4</span>, col:<span style="color: rgb(9, 134, 88);" class="">14</span>> col:<span style="color: rgb(9, 134, 88);" class="">4</span> ~ColorTag <span style="color: rgb(163, 21, 21);" class="">'</span><span style="color: rgb(0, 0, 255);" class="">void</span> () <span style="color: rgb(0, 0, 255);" class="">noexcept</span><span style="color: rgb(163, 21, 21);" class="">'</span></font></div><div class=""><font face="Menlo" size="1" class="">| `-CXXConstructorDecl <line:<span style="color: rgb(9, 134, 88);" class="">2</span>:<span style="color: rgb(9, 134, 88);" class="">7</span>> col:<span style="color: rgb(9, 134, 88);" class="">7</span> implicit <span style="color: rgb(0, 0, 255);" class="">constexpr</span> ColorTag <span style="color: rgb(163, 21, 21);" class="">'</span><span style="color: rgb(0, 0, 255);" class="">void</span> (<span style="color: rgb(0, 0, 255);" class="">const</span> ColorTag &)<span style="color: rgb(163, 21, 21);" class="">'</span> <span style="color: rgb(0, 0, 255);" class="">inline</span> <span style="color: rgb(0, 0, 255);" class="">default</span> trivial <span style="color: rgb(0, 0, 255);" class="">noexcept</span>-unevaluated <span style="color: rgb(48, 48, 192);" class="">0x557709f2c028</span></font></div><div class=""><font face="Menlo" size="1" class="">| `-ParmVarDecl <col:<span style="color: rgb(9, 134, 88);" class="">7</span>> col:<span style="color: rgb(9, 134, 88);" class="">7</span> <span style="color: rgb(163, 21, 21);" class="">'</span><span style="color: rgb(0, 0, 255);" class="">const</span> ColorTag &<span style="color: rgb(163, 21, 21);" class="">'</span></font></div><div class=""><font face="Menlo" size="1" class="">|-CXXConstructorDecl parent <span style="color: rgb(48, 48, 192);" class="">0x557709f2bb70</span> prev <span style="color: rgb(48, 48, 192);" class="">0x557709f2bdc8</span> <line:<span style="color: rgb(9, 134, 88);" class="">9</span>:<span style="color: rgb(9, 134, 88);" class="">1</span>, line:<span style="color: rgb(9, 134, 88);" class="">11</span>:<span style="color: rgb(9, 134, 88);" class="">1</span>> line:<span style="color: rgb(9, 134, 88);" class="">9</span>:<span style="color: rgb(9, 134, 88);" class="">11</span> ColorTag <span style="color: rgb(163, 21, 21);" class="">'</span><span style="color: rgb(0, 0, 255);" class="">void</span> ()<span style="color: rgb(163, 21, 21);" class="">'</span></font></div><div class=""><font face="Menlo" size="1" class="">| `-CompoundStmt <col:<span style="color: rgb(9, 134, 88);" class="">22</span>, line:<span style="color: rgb(9, 134, 88);" class="">11</span>:<span style="color: rgb(9, 134, 88);" class="">1</span>></font></div><div class=""><font face="Menlo" size="1" class="">`-CXXDestructorDecl parent <span style="color: rgb(48, 48, 192);" class="">0x557709f2bb70</span> prev <span style="color: rgb(48, 48, 192);" class="">0x557709f2beb8</span> <line:<span style="color: rgb(9, 134, 88);" class="">13</span>:<span style="color: rgb(9, 134, 88);" class="">1</span>, col:<span style="color: rgb(9, 134, 88);" class="">24</span>> col:<span style="color: rgb(9, 134, 88);" class="">11</span> ~ColorTag <span style="color: rgb(163, 21, 21);" class="">'</span><span style="color: rgb(0, 0, 255);" class="">void</span> () <span style="color: rgb(0, 0, 255);" class="">noexcept</span><span style="color: rgb(163, 21, 21);" class="">'</span></font></div><div class=""><font face="Menlo" size="1" class="">`-CompoundStmt <col:<span style="color: rgb(9, 134, 88);" class="">23</span>, col:<span style="color: rgb(9, 134, 88);" class="">24</span>></font></div></div></div><div>```</div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On Jul 30, 2020, at 7:02 AM, Billy Araujo <<a href="mailto:billyaraujo@gmail.com" class="">billyaraujo@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hi,</div><div class=""><br class=""></div><div class="">Also something else happens if you move <br class=""></div><div class="">ColorTag::~ColorTag() {}</div><div class=""><br class=""></div><div class="">down to be at line 261 (without changing scope) is now a CXXDestructorDecl but the line numbers are all screwed up.</div><div class=""><br class=""></div><div class="">CXXDestructorDecl 0x269fdc0 <line:307:3, col:13> col:3 ~ColorTag 'void () noexcept'</div><div class=""><br class=""></div><div class="">Regards,</div><div class=""><br class=""></div><div class="">Billy.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 30, 2020 at 11:54 AM Billy Araujo <<a href="mailto:billyaraujo@gmail.com" class="">billyaraujo@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class=""><div class="">Hi Dave,</div><div class=""><br class=""></div><div class="">Thanks for your reply. I don't think it is a cxxMemberCallExpr().<br class=""></div><div class="">I think it is parsing issue because this is what happens:</div><div class=""><br class=""></div><div class="">class ColorTag()</div><div class="">{</div><div class="">public:</div><div class=""> ColorTag():</div><div class=""> ~ColorTag();<br class=""></div><div class="">}<br class=""></div><div class=""><br class=""></div><div class="">ColorTag()::ColorTag() {</div><div class=""> //...<br class=""></div><div class="">}</div><div class=""><br class=""></div><div class="">ColorTag::~ColorTag() {}<br class=""></div><div class=""><br class=""></div><div class="">It is interpreted as: CXXMemberCallExpr() as if ColorTag::~ColorTag() was called inside the constructor. You can see below in the AST output cxxMemberCallExpr parent is CXXConstructorDecl.<br class=""></div><div class=""><br class=""></div><div class="">`-<span style="background-color:rgb(255,255,0)" class="">CXXConstructorDecl</span> 0x2e76988 parent 0x2e60608 prev 0x2e61578 <line:238:1, line:434:2> line:238:11 ColorTag 'void (const ColorTag &)' <br class=""> |-ParmVarDecl 0x2e768f8 <col:20, col:36> col:36 used tag 'const ColorTag &'<br class=""> |-CXXCtorInitializer 'PliObjectTag'<br class=""> | `-CXXConstructExpr 0x2e76b10 <line:239:7, col:39> 'PliObjectTag' 'void (const PliTag::Type)'<br class=""> | `-DeclRefExpr 0x2e76ab0 <col:20, col:28> 'PliTag::Type' EnumConstant 0x2e579e8 'COLOR_NGOBJ' 'PliTag::Type'<br class=""> |-CXXCtorInitializer Field 0x2e60e88 'm_style' 'ColorTag::styleType'<br class=""> | `-ImplicitCastExpr 0x2e76bd8 <line:240:15, col:19> 'ColorTag::styleType' <LValueToRValue><br class=""> | `-MemberExpr 0x2e76b88 <col:15, col:19> 'const ColorTag::styleType' lvalue .m_style 0x2e60e88<br class=""> | `-DeclRefExpr 0x2e76b68 <col:15> 'const ColorTag' lvalue ParmVar 0x2e768f8 'tag' 'const ColorTag &'<br class=""> |-CXXCtorInitializer Field 0x2e60ee8 'm_attribute' 'ColorTag::attributeType'<br class=""> | `-ImplicitCastExpr 0x2e76c88 <line:241:19, col:23> 'ColorTag::attributeType' <LValueToRValue><br class=""> | `-MemberExpr 0x2e76c38 <col:19, col:23> 'const ColorTag::attributeType' lvalue .m_attribute 0x2e60ee8<br class=""> | `-DeclRefExpr 0x2e76c18 <col:19> 'const ColorTag' lvalue ParmVar 0x2e768f8 'tag' 'const ColorTag &'<br class=""> `-CompoundStmt 0x2e76fb0 <line:242:36, line:434:2><br class=""> |-IfStmt 0x2e76d98 <line:243:3, line:249:1><br class=""> | |-OpaqueValueExpr 0x2e76d80 <<invalid sloc>> 'bool'<br class=""> | `-CompoundStmt 0x2e76d70 <line:243:28, line:249:1><br class=""> |-<span style="background-color:rgb(255,255,0)" class="">CXXMemberCallExpr</span> 0x2e76e68 <line:251:1, col:21> 'void'<br class=""> | `-MemberExpr 0x2e76e20 <col:1, col:12> '<bound member function type>' ->~ColorTag 0x2e61670<br class=""> | `-CXXThisExpr 0x2e76e10 <col:11> 'ColorTag *' implicit this</div><div class=""><br class=""></div><div class="">So this:</div><div class=""></div><div class=""><div class=""><br class=""></div><div class="">class ColorTag()</div><div class="">{</div><div class="">public:</div><div class=""> ColorTag():</div><div class=""> ~ColorTag();<br class=""></div><div class="">}<br class=""></div><div class=""><br class=""></div><div class="">ColorTag()::ColorTag() {</div><div class=""> //...<br class=""></div><div class="">}</div><div class=""><br class=""></div><div class="">ColorTag::~ColorTag() {}<br class=""></div></div><div class=""><br class=""></div><div class="">Is interpreted like this:</div><div class=""><br class=""></div><div class=""><div class=""><div class="">class ColorTag()</div><div class="">{</div><div class="">public:</div><div class=""> ColorTag():</div><div class=""> ~ColorTag();<br class=""></div><div class="">}<br class=""></div><div class=""><br class=""></div><div class="">ColorTag()::ColorTag() {</div><div class=""> //...</div><div class=""><div class=""><div class=""><div class=""> ColorTag::~ColorTag() {}</div><div class="">}<br class=""></div></div></div></div><div class=""><br class=""></div><div class="">Regards,</div><div class=""><br class=""></div><div class="">Billy.</div><div class=""><br class=""></div><div class=""></div></div></div><div class=""><br class=""></div><div class=""><br class=""></div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 30, 2020 at 1:27 AM David Rector <<a href="mailto:davrecthreads@gmail.com" target="_blank" class="">davrecthreads@gmail.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="">I think you are not distinguishing properly between the declaration of the destructor and its usage (via a CXXMemberCallExpr) within the implementation/"body" of some other method declaration (this body should be enclosed in a "CompoundStmt"). <div class=""><br class=""></div><div class="">For example, the dump of </div><div class=""><br class=""></div><div class="">```</div><div class=""><font face="Menlo" class="">struct ColorTag {</font></div><div class=""><font face="Menlo" class=""> ~ColorTag() {}<br class=""> void destroy() {<br class=""> ColorTag::~ColorTag();<br class=""> }<br class="">};</font></div><div class=""><font face="Menlo" class="">```</font></div><div class=""><br class=""></div><div class="">looks like this:</div><div class=""><br class=""></div><div class="">```</div><div class=""><font face="Menlo" class="">TranslationUnitDecl<br class="">`-CXXRecordDecl <line:1:1, line:5:1> line:1:8 struct ColorTag definition<br class=""> ...(Definition data, implicitly-generated declarations)...</font></div><div class=""><div style="background-color:rgb(255,255,254)" class=""><font face="Menlo" class=""> |-CXXDestructorDecl <line:2:5, col:18> col:5 used ~ColorTag 'void () noexcept'</font></div><font face="Menlo" class=""> |-CXXMethodDecl <line:2:5, line:4:5> line:2:10 destroy 'void ()'<br class=""> | `-CompoundStmt <col:20, line:4:5><br class=""> | `-CXXMemberCallExpr <line:3:9, col:29> 'void'<br class=""> | `-MemberExpr <col:9, col:20> '<bound member function type>' ->~ColorTag 0x55790cbbaa40<br class=""> | `-CXXThisExpr <col:19> 'ColorTag *' implicit this<br class=""></font><div class=""><font face="Menlo" class=""> ...</font></div><div class="">```</div><div class=""><br class=""></div><div class="">Hope that helps, good luck,</div><div class=""><br class=""></div><div class="">Dave</div><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Jul 29, 2020, at 10:40 AM, Billy Araujo via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Hi,<div class=""><br class=""></div><div class="">On project opentoonz there is a file called:</div><div class="">opentoonz/toonz/sources/image/pli/tags.cp<br class=""></div><div class=""><br class=""></div><div class="">If I run clang-check, the AST it builds seems wrong.</div><div class=""><br class=""></div><div class="">clang-check -ast-dump /home/opentoonz/toonz/sources/image/pli/tags.cpp | grep -B 1 -A 1 "~ColorTag"<br class=""></div><div class=""><br class=""></div><div class=""> |-CXXMemberCallExpr 0x22893e8 <line:253:1, col:21> 'void'<br class=""> | `-MemberExpr 0x22893a0 <col:1, col:12> '<bound member function type>' ->~ColorTag 0x2274c00<br class=""> | `-CXXThisExpr 0x2289390 <col:11> 'ColorTag *' implicit this<br class=""></div><div class=""><br class=""></div><div class="">Line 253 appears as a CXXMemberCallExpr instead of a CXXDestructorDecl.</div><div class=""><br class=""></div><div class="">So the AST thinks it is calling an explicit destructor method call although it is a destructor implementation.</div><div class=""><br class=""></div><div class="">clang-check --version<br class="">LLVM (<a href="http://llvm.org/" target="_blank" class="">http://llvm.org/</a>):<br class=""> LLVM version 10.0.0<br class=""> <br class=""> Optimized build.<br class=""> Default target: x86_64-pc-linux-gnu<br class=""> Host CPU: nehalem<br class=""></div><div class=""><br class=""></div><div class="">Is this a bug or am I missing something?</div><div class=""><br class=""></div><div class="">Regards,</div><div class=""><br class=""></div><div class="">Billy.</div><div class=""><br class=""></div></div>
_______________________________________________<br class="">cfe-dev mailing list<br class=""><a href="mailto:cfe-dev@lists.llvm.org" target="_blank" class="">cfe-dev@lists.llvm.org</a><br class=""><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank" class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></div>
</blockquote></div>
</div></blockquote></div><br class=""></div></body></html>