[PATCH] D51729: [Tooling] JSONCompilationDatabasePlugin infers compile commands for missing files
Peter Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 5 09:01:39 PST 2018
Lekensteyn added a comment.
Before this patch, missing compilation database entries resulted in "Skipping .... Compile command not found." which is assumed by the tests in this clang-query patch: https://reviews.llvm.org/D54109
After this patch, a command is inferred, but this is not always desired.
Use case: find all function calls with a certain name using the compilation database produced by CMake.
clang-query -p=/tmp/wsbuild -c 'set output print' -c 'm callExpr(callee(functionDecl(hasName("uat_new"))))' $(grep -rl uat_new epan/dissectors/)
Expected result for some template files which do not exist in the compilation database:
Skipping .../epan/dissectors/asn1/x509af/packet-x509af-template.c. Compile command not found.
Actual result (clang-query tries to parse the contents which will fail since it is not an actual C source file):
.../epan/dissectors/asn1/x509af/packet-x509af-template.c:18:10: fatal error: 'packet-ber.h' file not found
I'm not entirely sure what to do here. The old behavior works great in cases where a complete database is available (produced by CMake). The new behavior might work better for clangd (?), but it breaks a use case (see above).
More information about the cfe-commits