[clang] [analyzer][NFC] Cleanup BugType lazy-init patterns (PR #76655)

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 31 22:13:10 PST 2023


================
@@ -31,14 +31,14 @@ class InvalidatedIteratorChecker
                    check::PreStmt<ArraySubscriptExpr>,
                    check::PreStmt<MemberExpr>> {
 
-  std::unique_ptr<BugType> InvalidatedBugType;
+  const BugType InvalidatedBugType{this, "Iterator invalidated",
+                                   "Misuse of STL APIs"};
 
   void verifyAccess(CheckerContext &C, const SVal &Val) const;
-  void reportBug(const StringRef &Message, const SVal &Val,
-                 CheckerContext &C, ExplodedNode *ErrNode) const;
-public:
-  InvalidatedIteratorChecker();
+  void reportBug(const StringRef &Message, const SVal &Val, CheckerContext &C,
----------------
Xazax-hun wrote:

Since we are changing this code, I guess we do not want to take `StringRef`s as const references.

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


More information about the cfe-commits mailing list