[clang] [WIP] [analyzer] Refactor MallocChecker to use `BindExpr` in `evalCall` (PR #106081)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 27 09:02:34 PDT 2024


================
@@ -2815,7 +2906,7 @@ MallocChecker::ReallocMemAux(CheckerContext &C, const CallEvent &Call,
 
     // Get the from and to pointer symbols as in toPtr = realloc(fromPtr, size).
     SymbolRef FromPtr = arg0Val.getLocSymbolInBase();
-    SVal RetVal = C.getSVal(CE);
+    SVal RetVal = stateRealloc->getSVal(CE, C.getLocationContext());
     SymbolRef ToPtr = RetVal.getAsSymbol();
     assert(FromPtr && ToPtr &&
            "By this point, FreeMemAux and MallocMemAux should have checked "
----------------
NagyDonat wrote:

Is the text of this assertion still accurate? (Probably yes, because I don't think that there is any realloc-into-alloca function, but it's worth a check.)

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


More information about the cfe-commits mailing list