<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    On 5/2/18 3:58 AM, Artem Razin via cfe-dev wrote:<br>
    <blockquote type="cite"
cite="mid:CACS3OuSM_PNzY27m66AtYBB8Ox86DV7fXJr+W=N6j1WOF6EWoQ@mail.gmail.com">
      <div dir="ltr">Hi All,
        <div><br>
        </div>
        <div>I hope this is right place to ask such a newbie question
          like the following.</div>
        <div><br>
        </div>
        <div>I am trying to write a checker to catch potential handle
          leaks (it's on Windows: a handle is closed by CloseHandle).</div>
        <div><br>
        </div>
        <div>So I took SimpleStreamChecker as a base, now my
          checkPreCall() checks if "CloseHandle" is called.
          Call.isCalled() works great except one case when CloseHandle
          is called by pointer. It happens because of using a template
          class that took a pointer to closing function as template
          parameter (useful to close different types of handles by
          appropriate functions: FindClose, CloseHandle etc.).</div>
        <div><br>
        </div>
        <div>Call.dump() prints "&CloseHandle(this->m_h)" in this
          case, so it understands that this a pointer and that this is a
          pointer of CloseHandle.But how to "extract" the the identifier
          of CloseHandle?<br>
        </div>
      </div>
    </blockquote>
    <br>
    I'm not quite understanding that dump, it looks a bit weird. What is
    the actual code under analysis? Could you see if you can get
    Call.getOriginExpr()->dump() and/or Call.getDecl()->dump()?
    These should be more informative.<br>
    <br>
    In general the analyzer does indeed understand calls through
    function pointers, as long as it can at all be tracked by looking at
    the current execution path.<br>
    <br>
    And when it is tracked, CallEvent::isCalled() should "just work"
    because it only looks at Call.getDecl() which should be the
    path-specific decl.<br>
    <br>
    <blockquote type="cite"
cite="mid:CACS3OuSM_PNzY27m66AtYBB8Ox86DV7fXJr+W=N6j1WOF6EWoQ@mail.gmail.com">
      <div dir="ltr">
        <div><br>
        </div>
        <div>Thank you in advance!</div>
        <div>
          <div><br>
          </div>
          -- <br>
          <div class="gmail_signature">Best regards, <br>
            Artem A. Razin</div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>