<div dir="ltr">The only thing I can suggest is to use clang-query and start from the most basic matcher, say functionDecl, then gradually constrain it using hasName, etc. See at what point you get the crash. Reducing your input source might also help, if this is a Clang bug you'll have a minimal repro case. I've only tried my query on a super simple file.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 12, 2015 at 11:36 AM, Riyad Parvez <span dir="ltr"><<a href="mailto:riyad.parvez@gmail.com" target="_blank">riyad.parvez@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 bgcolor="#FFFFFF" text="#000000">
    Hi,<span class=""><br>
    <br>
    <div>On 04/18/2015 01:19 AM, Nikola
      Smiljanic wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Use clang-query to try things out, you'll need to
        generate compilation database to use it but that shouldn't be
        too hard. It sure beats having to recompile your code to test
        it.<br>
        <br>
      </div>
    </blockquote>
    <blockquote type="cite">
      <div dir="ltr">The matcher you're after is probably
        callExpr(callee(functionDecl(hasName("malloc"))))<br>
        <br>
      </div>
    </blockquote>
    <br></span>
    I've tried your query and getting segmentation fault. I've tried to
    get backtrace from gdb, but for some reason gdb is printing garbage.<br>
    <br>
    Thanks<span class="HOEnZb"><font color="#888888"><br>
    Riyad</font></span><span class=""><br>
    <blockquote type="cite">
      <div dir="ltr">On Tue, Apr 7, 2015 at 10:49 AM, Riyad Parvez <<a href="mailto:riyad.parvez@gmail.com" target="_blank">riyad.parvez@gmail.com</a>>
        wrote:<br>
        ><br>
        > Hi All,<br>
        ><br>
        > I want to find all the instances of calls to a specific
        function. Right now, I can find all the function calls using
        ASTMatcher using following code:<br>
        ><br>
        > Finder.addMatcher(<br>
        >
callExpr(hasParent(binaryOperator(hasOperatorName("=")).bind("assignment"))).bind("functionCall"),<br>
        >       &HandlerForFunctionCall);<br>
        ><br>
        > But I want to find all the function calls whose name is say
        "malloc". I know how do that using classic "RecursiveASTVisitor"
        class, but how can I do this using ASTMatcher?<br>
        ><br>
        > Thanks<br>
        > Riyad<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></div>
    </blockquote>
    <br>
  </span></div>

</blockquote></div><br></div>