1

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?

MattDs17
  • 401
  • 1
  • 4
  • 20

1 Answers1

0

It looks like this can be done with the isExpansionInMainFile matcher (reference).

For example, the query would become match ifStmt(isExpansionInMainFile()).

MattDs17
  • 401
  • 1
  • 4
  • 20