[clang] [analyzer] Variant checker bindings (PR #87886)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Tue May 14 05:26:04 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;
----------------
NagyDonat wrote:
Are you sure that `ThisRegion` cannot be null?
I suspect that `ThisSVal` might be `UnknownVal` in some circumstances (e.g. invalidation, complexity limit reached etc.) and that would lead to a `getAsRegion()` returning `nullptr` while modeling e.g. an assignment operator call.
https://github.com/llvm/llvm-project/pull/87886
More information about the cfe-commits
mailing list