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

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 1 09:15:00 PST 2024


================
@@ -17,19 +17,18 @@
 
 #include "MPITypes.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
+#include "llvm/ADT/StringRef.h"
 
 namespace clang {
 namespace ento {
 namespace mpi {
 
 class MPIBugReporter {
 public:
-  MPIBugReporter(const CheckerBase &CB) {
-    UnmatchedWaitBugType.reset(new BugType(&CB, "Unmatched wait", MPIError));
-    DoubleNonblockingBugType.reset(
-        new BugType(&CB, "Double nonblocking", MPIError));
-    MissingWaitBugType.reset(new BugType(&CB, "Missing wait", MPIError));
-  }
+  MPIBugReporter(const CheckerBase &CB)
+      : UnmatchedWaitBugType(&CB, "Unmatched wait", MPIError),
----------------
steakhal wrote:

I considered that, but couldn't as `CB` is a ctor param. I don't have that in a field init context.

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


More information about the cfe-commits mailing list