[clang] [analyzer][NFC] Introduce framework for checker families (PR #139256)
Donát Nagy via cfe-commits
cfe-commits at lists.llvm.org
Tue May 20 03:02:44 PDT 2025
================
@@ -115,9 +115,22 @@ class CheckerRegistry {
public:
/// Adds a checker to the registry. Use this non-templated overload when your
/// checker requires custom initialization.
- void addChecker(RegisterCheckerFn Fn, ShouldRegisterFunction sfn,
+ void addChecker(RegisterCheckerFn Fn, ShouldRegisterFunction Sfn,
+ StringRef FullName, StringRef DebugName, StringRef Desc,
+ StringRef DocsUri, bool IsHidden);
+
+ /// Adds a checker to the registry. This overload doesn't take a `DebugName`
+ /// (which usually looks like `DivZeroChecker`), so it uses the user-facing
+ /// `FullName` (which usually looks like ``core.DivideZero`) as a debug name.
+ /// THIS IS DEPRECATED and is only provided to preserve compatibility with
+ /// legacy plugins.
+ /// TODO: Eventually remove this from the codebase.
----------------
NagyDonat wrote:
It would be straightforward to update the templated variant of `addChecker` by adding an extra `DebugName` parameter and updating all the code that calls it – but it is called from 20+ locations, so I felt that it would be bothersome to update them all:
```
clang/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h |141 Col 8| void addChecker(StringRef FullName, StringRef Desc, StringRef DocsUri,
clang/lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp |20 Col 12| registry.addChecker<Dependency>("example.Dependency", "", "");
clang/lib/Analysis/plugins/CheckerDependencyHandling/CheckerDependencyHandling.cpp |21 Col 12| registry.addChecker<DependendentChecker>("example.DependendentChecker", "",
clang/lib/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp |48 Col 12| registry.addChecker<MainCallChecker>(
clang/unittests/StaticAnalyzer/BugReportInterestingnessTest.cpp |122 Col 16| Registry.addChecker<InterestingnessTestChecker>("test.Interestingness",
clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp |623 Col 14| Registry.addChecker<CallDescChecker>("test.CallDescChecker", "Description",
clang/unittests/StaticAnalyzer/CallEventTest.cpp |58 Col 14| Registry.addChecker<CXXDeallocatorChecker>("test.CXXDeallocator",
clang/unittests/StaticAnalyzer/ExprEngineVisitTest.cpp |80 Col 14| Registry.addChecker<ExprEngineVisitPreChecker>("ExprEngineVisitPreChecker",
clang/unittests/StaticAnalyzer/ExprEngineVisitTest.cpp |89 Col 14| Registry.addChecker<ExprEngineVisitPostChecker>(
clang/unittests/StaticAnalyzer/ExprEngineVisitTest.cpp |98 Col 14| Registry.addChecker<MemAccessChecker>("MemAccessChecker", "Desc",
clang/unittests/StaticAnalyzer/ObjcBug-124477.cpp |39 Col 14| Registry.addChecker<FlipFlagOnCheckLocation>("test.FlipFlagOnCheckLocation",
clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp |47 Col 14| Registry.addChecker<CustomChecker>("test.CustomChecker", "Description", "");
clang/unittests/StaticAnalyzer/RegisterCustomCheckersTest.cpp |76 Col 14| Registry.addChecker<CustomChecker>("test.LocIncDecChecker", "Description",
clang/unittests/StaticAnalyzer/SValSimplifyerTest.cpp |71 Col 14| Registry.addChecker<SimplifyChecker>("SimplifyChecker", "EmptyDescription",
clang/unittests/StaticAnalyzer/SValTest.cpp |160 Col 1| SVAL_TEST(GetConstType, R"(
clang/unittests/StaticAnalyzer/SValTest.cpp |180 Col 1| SVAL_TEST(GetLocAsIntType, R"(
clang/unittests/StaticAnalyzer/SValTest.cpp |202 Col 1| SVAL_TEST(GetSymExprType, R"(
clang/unittests/StaticAnalyzer/SValTest.cpp |224 Col 1| SVAL_TEST(GetPointerType, R"(
clang/unittests/StaticAnalyzer/SValTest.cpp |278 Col 1| SVAL_TEST(GetCompoundType, R"(
clang/unittests/StaticAnalyzer/SValTest.cpp |330 Col 1| SVAL_TEST(GetStringType, R"(
clang/unittests/StaticAnalyzer/SValTest.cpp |342 Col 1| SVAL_TEST(GetThisType, R"(
clang/unittests/StaticAnalyzer/SValTest.cpp |359 Col 1| SVAL_TEST(GetFunctionPtrType, R"(
clang/unittests/StaticAnalyzer/SValTest.cpp |372 Col 1| SVAL_TEST(GetLabelType, R"(
clang/unittests/StaticAnalyzer/TestReturnValueUnderConstruction.cpp |52 Col 16| Registry.addChecker<TestReturnValueUnderConstructionChecker>(
```
https://github.com/llvm/llvm-project/pull/139256
More information about the cfe-commits
mailing list