[PATCH] D66042: [analyzer] Analysis: "Disable" core checkers

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 9 19:15:27 PDT 2019


NoQ added reviewers: alexfh, Szelethus.
NoQ added a subscriber: alexfh.
NoQ added a comment.

+ at alexfh because clang-tidy now finally has a way of safely disabling core checkers without causing crashes all over the place! Would you like to take the same approach as we picked in scan-build, i.e. when the user asks to disable a core checker, silence it instead?

+ at Szelethus because enabling-disabling checkers is his realm.



================
Comment at: clang/include/clang/Driver/CC1Options.td:127-128
 
+def analyzer_disable_warning : Separate<["-"], "analyzer-disable-warning">,
+  HelpText<"Choose analyzer checkers of the warnings to disable">;
+def analyzer_disable_warning_EQ : Joined<["-"], "analyzer-disable-warning=">,
----------------
How about `-analyzer-silence-checker`?


================
Comment at: clang/lib/StaticAnalyzer/Core/BugReporter.cpp:1924
+
+  // The 'CheckerName' could be 'core' so that 'contains()' is appropriate.
+  for (const std::string &CheckerName : Opts.CheckerWarningVector) {
----------------
`startswith`?


================
Comment at: clang/tools/scan-build/bin/scan-build:1749
+      # to emit a report from the checker so we have to disable the warning.
+      if (index($Checker, "core") != -1) {
+        $Options{DisableWarnings}{$Checker} = $NumArgs;
----------------
Also some sort of `startswith`.


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

https://reviews.llvm.org/D66042





More information about the cfe-commits mailing list