[clang] [NFC][analyzer] Replace BlockInCriticalSection MutexDescriptor with CallDescriptionMap (PR #224230)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 1 04:33:35 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();
----------------
steakhal wrote:
I can see two ways out of this one:
- Rename `CXXDtorCalls` to `CXXAutomaticDtorCalls` - easy.
- Make it intuitive and change the implementation such that any dtor calls (no matter how they are spelled) would get translated into a `CXXDtorCalls` event. This sounds more aligned with the sentiment of CallEvents, but much more difficult because checkers can (and probably do) expect the current semantics. They probably should also expect explicit dtor calls to be pedantic and correct though.- hard.
The next question is, is it worth to get into this?
It definitely worths a comment at the CXXDtorCalls type though.
https://github.com/llvm/llvm-project/pull/224230
More information about the cfe-commits
mailing list