[PATCH] D75842: [Analyzer] Bugfix for CheckerRegistry

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 9 05:20:35 PDT 2020


baloghadamsoftware created this revision.
baloghadamsoftware added reviewers: NoQ, Szelethus.
baloghadamsoftware added a project: clang.
Herald added subscribers: martong, steakhal, Charusso, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, xazax.hun, whisperity.

`CheckerRegistry` registers a checker either if it is excplicitly enabled or it is a dependency of an explicitly enabled checker and is not explicitly disabled. In both cases it is also important that the checker should be registered (`shoudRegister`//XXX//`()` returns true).

Currently there is a bug here: if the dependenct checker is not explicitly disabled it is registered regardless of whether it should be registered. This patch fixes this bug.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75842

Files:
  clang/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h


Index: clang/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h
===================================================================
--- clang/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h
+++ clang/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h
@@ -166,7 +166,7 @@
     }
 
     bool isDisabled(const LangOptions &LO) const {
-      return State == StateFromCmdLine::State_Disabled && ShouldRegister(LO);
+      return State == StateFromCmdLine::State_Disabled || !ShouldRegister(LO);
     }
 
     // Since each checker must have a different full name, we can identify


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75842.249066.patch
Type: text/x-patch
Size: 594 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200309/97653335/attachment-0001.bin>


More information about the cfe-commits mailing list