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.
Example command:

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


Repository:
  rC Clang

https://reviews.llvm.org/D51729



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to