[clang] [NFC][analyzer] Replace BlockInCriticalSection MutexDescriptor with C… (PR #224230)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 17 04:46:01 PDT 2026


================
@@ -25,16 +25,43 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
 #include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
 
 #include <iterator>
 #include <utility>
-#include <variant>
 
 using namespace clang;
 using namespace ento;
 
+static const MemRegion *getFirstArgRegion(const CallEvent &Call) {
+  return Call.getArgSVal(0).getAsRegion();
+}
+
+static const MemRegion *getCXXThisRegion(const CallEvent &Call) {
+  return cast<CXXMemberCall>(Call).getCXXThisVal().getAsRegion();
+}
+
+static const MemRegion *getObjectUnderConstruction(const CallEvent &Call) {
+  if (std::optional<SVal> Object = Call.getReturnValueUnderConstruction())
+    return Object->getAsRegion();
+  return nullptr;
+}
+
+static const MemRegion *getCXXDestructorThisRegion(const CallEvent &Call) {
+  return cast<CXXDestructorCall>(Call).getCXXThisVal().getAsRegion();
+}
+
+static bool isNotDeferLockUniqueLock(const CallEvent &Call) {
+  if (Call.getNumArgs() < 2)
+    return true;
+  const Expr *SecondArg = Call.getArgExpr(1);
+  QualType ArgType = SecondArg->getType().getNonReferenceType();
----------------
steakhal wrote:

I'm pretty sure you just copied this hunk over, but it's funky to me why we go to an Expr to then go to a Type if we could have just asked for the ParamVarDecl and get the type from that.

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


More information about the cfe-commits mailing list