<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 11, 2015 at 2:39 AM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><div class="h5"><div dir="ltr">On Thu, Jun 11, 2015 at 11:33 AM Kevin Funk <<a href="mailto:kfunk@kde.org" target="_blank">kfunk@kde.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Heya,<br>
<br>
I've found clang-query to be useful to query single files. Matching the Clang<br>
AST is easy enough and fast to learn. I don't see how to use clang-query on a<br>
whole project, though, which would be super useful.<br>
<br>
A simple example where it's effectively useless: Assume some header "global.h"<br>
containing "struct Global {};", every file in the project includes this header.<br>
<br>
Now the idiomatic way to run clang-query over all the files in the project:<br>
  clang-query -p $BUILD $(find . -name "*.cpp")<br>
<br>
Let's try to find record decls named "Global":<br>
  match recordDecl(hasName("Global"), isDefinition())<br>
<br>
=> You get one match per file / translation unit. But in fact, this is not<br>
really what you want. You want one match here.<br>
<br>
So of course this is difficult: clang-query is TU-centric, while for a whole<br>
project you'd "somehow" want a global view over the source code and not have<br>
duplicate results for a query like above.<br>
<br>
Questions:<br>
- Is it possible to get clang-query to behave like that?<br>
  - Any research/pointers in that regard?<br>
- Is it possible to filter duplicates in the results without external tools?<br>
<br>
Thanks a lot for a great tool so far!<br></blockquote><div><br></div></div></div><div>Well, usually at that point you'll want to start writing a go/clangmr.</div></div></div></blockquote><div><br></div><div>What is "go/clangmr"? Some sort of golang library? Can't seem to find a reference other than <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__research.google.com_pubs_pub41342.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=VQcoH58OOqt8UguEXN6SNUsxImNsEIVOpsLBoZoV9jw&s=D85eDFfVLAj750vWT3AwGJfmTyx4N69I20nfZu9OTOo&e=">http://research.google.com/pubs/pub41342.html</a> but no mention of "go".</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>It might also be cool to make clang-query work as clangmr; sounds like that would be a nice 20% project ;)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Greets<span class=""><font color="#888888"><br>
<br>
--<br>
Kevin Funk | <a href="mailto:kfunk@kde.org" target="_blank">kfunk@kde.org</a> | <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__kfunk.org&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=0CyHQX4kFht-O-Dq4O9unNWXJr-EdeaxjoOo2AN8vhE&s=ujWrYOxcQV8goq5L7MFeVqPdHVHUoKvb_5p5Z8v8Oq0&e=" rel="noreferrer" target="_blank">http://kfunk.org</a>_______________________________________________<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" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</font></span></blockquote></div></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>