简体   繁体   中英

Running clang-query only on input files

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 (eg 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()) .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM