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

Anna Zaks zaks.anna at gmail.com
Wed Jun 17 22:23:49 PDT 2015


================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:158
@@ +157,3 @@
+/// zero-allocated memory returned by 'realloc(ptr, 0)'.
+struct ReallocSizeZero {
+  void Profile(llvm::FoldingSetNodeID &ID) const {
----------------
This struct does not contain any fields. What's its purpose?

================
Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:524
@@ -511,2 +523,3 @@
 REGISTER_MAP_WITH_PROGRAMSTATE(ReallocPairs, SymbolRef, ReallocPair)
+REGISTER_MAP_WITH_PROGRAMSTATE(ReallocSizeZeroFlag, SymbolRef, ReallocSizeZero)
 
----------------
Maybe you should use a set of SymbolRefs instead?

http://reviews.llvm.org/D9040

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list