[PATCH] D9040: [analyzer] Make realloc(ptr, 0) handling equivalent to malloc(0).

Антон Ярцев via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 1 15:02:03 PDT 2015


ayartsev added inline comments.

================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:523
@@ -510,2 +522,3 @@
 REGISTER_MAP_WITH_PROGRAMSTATE(ReallocPairs, SymbolRef, ReallocPair)
+REGISTER_MAP_WITH_PROGRAMSTATE(ReallocSizeZeroFlag, SymbolRef, ReallocSizeZero)
 
----------------
zaks.anna wrote:
> I do not think this is related to my question.
> 
> You add a map from a symbol to a "flag" here; not really a flag but the empty struct ReallocSizeZero. The only ways this is used is to set in the state that the symbol is zero realloced or query if the specific symbol is zero realloced. It seems that using the set of zero realloced symbols would be the right data structure here.
> 
> Why do we need the extra complexity of the map and the empty struct?
Got it! Updated the patch.


http://reviews.llvm.org/D9040





More information about the cfe-commits mailing list