[clang] [analyzer] Prettify checker registration and unittest code (PR #147797)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 10 06:34:49 PDT 2025


=?utf-8?q?Don=C3=A1t?= Nagy <donat.nagy at ericsson.com>,
=?utf-8?q?Don=C3=A1t?= Nagy <donat.nagy at ericsson.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/147797 at github.com>


================
@@ -3,12 +3,16 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
 #include "clang/StaticAnalyzer/Frontend/CheckerRegistry.h"
 
+// This simple plugin is used by clang/test/Analysis/checker-plugins.c
+// to test the use of a checker that is defined in a plugin.
+
 using namespace clang;
 using namespace ento;
 
 namespace {
 class MainCallChecker : public Checker<check::PreStmt<CallExpr>> {
-  mutable std::unique_ptr<BugType> BT;
+
+  BugType BT{this, "call to main", "example analyzer plugin"};
----------------
steakhal wrote:

Can you make this const?

https://github.com/llvm/llvm-project/pull/147797


More information about the cfe-commits mailing list