================
@@ -56,111 +92,25 @@ struct CritSectionMarker {
   }
 };
 
-class CallDescriptionBasedMatcher {
-  CallDescription LockFn;
-  CallDescription UnlockFn;
-
-public:
-  CallDescriptionBasedMatcher(CallDescription &&LockFn,
-                              CallDescription &&UnlockFn)
-      : LockFn(std::move(LockFn)), UnlockFn(std::move(UnlockFn)) {}
-  [[nodiscard]] bool matches(const CallEvent &Call, bool IsLock) const {
-    if (IsLock) {
-      return LockFn.matches(Call);
-    }
-    return UnlockFn.matches(Call);
-  }
+enum class RoleKind {
+  Lock,
+  Unlock,
 };
 
-class FirstArgMutexDescriptor : public CallDescriptionBasedMatcher {
-public:
-  FirstArgMutexDescriptor(CallDescription &&LockFn, CallDescription &&UnlockFn)
-      : CallDescriptionBasedMatcher(std::move(LockFn), std::move(UnlockFn)) {}
-
-  [[nodiscard]] const MemRegion *getRegion(const CallEvent &Call, bool) const {
-    return Call.getArgSVal(0).getAsRegion();
-  }
+// llvm::function_ref does not reject stateful functors/capturing lambdas, so
+// function pointers are used to avoid future issues coming from those objects'
+// lifetimes (more specifically to prevent such configuration entries from
+// compiling, increasing robustness).
+using GetRegionFn = const MemRegion *(*)(const CallEvent &);
+using FilterFn = bool (*)(const CallEvent &);
+
+struct ThreadingCallDescription {
+  RoleKind Role;
+  GetRegionFn GetRegion = getFirstArgRegion;
+  // Keep every call by default.
----------------
steakhal wrote:

```suggestion
```

https://github.com/llvm/llvm-project/pull/224230
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to