[PATCH] D81315: [analyzer] Warning for default constructed unique pointer dereferences

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 28 10:16:10 PDT 2020


Szelethus requested changes to this revision.
Szelethus added a comment.
This revision now requires changes to proceed.

I have a few pending patches that enforce some long desired restrictions on which checkers can emit diagnostics, and I'd prefer not to mess with your checker after you land this :/



================
Comment at: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td:577-583
+  CheckerOptions<[
+    CmdLineOption<Boolean,
+                  "CheckSmartPtrDereference",
+                  "Enable check for SmartPtr null dereferences",
+                  "false",
+                  InAlpha>,
+  ]>,
----------------
This goes against D81750 -- Sorry for not bringing this up earlier, but you can't emit diagnostics from a checker that is hidden :/

The proper solution would be to create a non-hidden checker, and emit a diagnostic under its name. You can take inspiration from `MallocChecker`, `NullabilityChecker`, and a variety of other sound in the stack of this patch: D77845


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

https://reviews.llvm.org/D81315





More information about the cfe-commits mailing list