<div dir="ltr"><div><div><div><div><div><div><div><div>Hi!<br><br></div>I was implementing a SA checker when I ran into the next (problem?) :<br></div>Whenever I write a callback PostCall/PreCall with the next body:<br><br>{<br>if (dyn_cast<CXXDestructorCall>(&Call))<br>    llvm::errs() << "DtorCall\n";<br><br>  if (dyn_cast<CXXDestructorDecl>(Call.getDecl()))<br>    llvm::errs() << "DtorDecl\n";<br><br>  return;<br>}<br><br></div>Then I could not find a case where the cast to CXXDestructorCall is successful.<br></div>Running this simple "checker" on the <b>below example emitted no output</b> to errs:<br><br>class A {<br>};<br>int main()<br>{<br>A a;<br> {<br> A b;<br> }<br>}<br><br><div>However if change the inner block this way:<br> {<br></div><div> A b;<br></div><div> b.~A();<br></div><div> }<br></div><div>then "DtorDecl" is displayed which makes sense.<br><br></div><div>The detailed description of the CXXDestructorCall says:<br>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div class="gmail-textblock"><p>Represents an implicit call to a C++ destructor.</p><p>This <b>can</b> occur at the end of a scope (for automatic objects), at the 
end of a full-expression (for temporaries), or as part of a delete. </p></div></blockquote>My question is: Does "can" mean in this context that the callback is quite unreliable even in trivial cases or is it a bug and the destructor call should trigger?<br><br></div><div>Thanks,<br><br></div><div>Peter<br></div><div><br><br><br></div></div></div></div></div></div>