I'm running clang-query on a specific file using a compilation database as follows:
clang-query -p build foo/bar.cpp
This works, but when I run a simple query (e.g. match ifStmt()
) it returns thousands of results, including matches from imported headers and even the standard library.
Is there a way to restrict results to the file(s) that I launched clang-query with?
It looks like this can be done with the
isExpansionInMainFile
matcher (reference).For example, the query would become
match ifStmt(isExpansionInMainFile())
.