[clang] [analyzer] Variant checker bindings (PR #87886)

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 8 09:10:47 PDT 2024


================
@@ -51,27 +47,29 @@ removeInformationStoredForDeadInstances(const CallEvent &Call,
 }
 
 template <class TypeMap>
-void handleConstructorAndAssignment(const CallEvent &Call, CheckerContext &C,
+bool handleConstructorAndAssignment(const CallEvent &Call, CheckerContext &C,
                                     SVal ThisSVal) {
   ProgramStateRef State = Call.getState();
 
   if (!State)
-    return;
+    return false;
 
   auto ArgSVal = Call.getArgSVal(0);
   const auto *ThisRegion = ThisSVal.getAsRegion();
   const auto *ArgMemRegion = ArgSVal.getAsRegion();
+  if (!ArgMemRegion)
+    return false;
 
   // Make changes to the state according to type of constructor/assignment
   bool IsCopy = isCopyConstructorCall(Call) || isCopyAssignmentCall(Call);
   bool IsMove = isMoveConstructorCall(Call) || isMoveAssignmentCall(Call);
   // First we handle copy and move operations
   if (IsCopy || IsMove) {
-    const QualType *OtherQType = State->get<TypeMap>(ArgMemRegion);
-
+    // const QualType *OtherQType = State->get<TypeMap>(ArgMemRegion);
----------------
NagyDonat wrote:

```suggestion
```
Remove this comment -- it seems to be an accidental leftover.

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


More information about the cfe-commits mailing list