<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi,<br>
<br>
<div class="moz-cite-prefix">On 04/18/2015 01:19 AM, Nikola
Smiljanic wrote:<br>
</div>
<blockquote
cite="mid:CAGq7tnM7hac1cEbLFNbYPw4yNzcDwdGtH92nG1zifS9JTqOrvw@mail.gmail.com"
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
cite="mid:CAGq7tnM7hac1cEbLFNbYPw4yNzcDwdGtH92nG1zifS9JTqOrvw@mail.gmail.com"
type="cite">
<div dir="ltr">The matcher you're after is probably
callExpr(callee(functionDecl(hasName("malloc"))))<br>
<br>
</div>
</blockquote>
<br>
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<br>
Riyad<br>
<blockquote
cite="mid:CAGq7tnM7hac1cEbLFNbYPw4yNzcDwdGtH92nG1zifS9JTqOrvw@mail.gmail.com"
type="cite">
<div dir="ltr">On Tue, Apr 7, 2015 at 10:49 AM, Riyad Parvez <<a
moz-do-not-send="true" href="mailto:riyad.parvez@gmail.com">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 moz-do-not-send="true"
href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a moz-do-not-send="true"
href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a></div>
</blockquote>
<br>
</body>
</html>