[PATCH] D97805: [clang-query] Add option to enable only displaying main file matches

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 3 06:52:03 PST 2021


aaron.ballman added inline comments.


================
Comment at: clang-tools-extra/clang-query/Query.cpp:60-61
+        "    main-file-only                  "
+        "Only match nodes from the main source file. This mode is the "
+        "default.\n"
         "  set output <feature>              "
----------------
I'm not super keen on this being the default behavior. One of the big uses for clang-query is to experiment with matchers and I think ignoring nodes by default makes it harder to know whether you've written the matcher correctly or not. e.g., you write the matcher, run it over a source file, don't get any results -- is that because the matcher was nonsense or because the mode excluded matching on nodes in headers by default?

The fact that we print how many nodes were skipped does help (so it's not a silent when you match only in headers), but I think the default behavior should be to match on what's in the source code (which includes header contents) and users should have to opt into getting less results. WDYT?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97805/new/

https://reviews.llvm.org/D97805



More information about the cfe-commits mailing list