[PATCH] D68165: [analyzer][MallocChecker][NFC] Split checkPostCall up, deploy CallDescriptionMap

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 27 15:25:50 PDT 2019


Szelethus marked 2 inline comments as done.
Szelethus added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:890
 
-bool MemFunctionInfoTy::isCMemAllocFunction(const CallEvent &Call) const {
-  if (Call.isCalled(CD_malloc, CD_realloc, CD_reallocf, CD_calloc, CD_valloc,
-                    CD_strdup, CD_win_strdup, CD_strndup, CD_wcsdup,
-                    CD_win_wcsdup, CD_kmalloc, CD_g_malloc, CD_g_malloc0,
-                    CD_g_realloc, CD_g_try_malloc, CD_g_try_malloc0,
-                    CD_g_try_realloc, CD_g_memdup, CD_g_malloc_n,
-                    CD_g_malloc0_n, CD_g_realloc_n, CD_g_try_malloc_n,
-                    CD_g_try_malloc0_n, CD_g_try_realloc_n))
-    return true;
-
-  if (Call.isCalled(CD_if_nameindex))
-    return true;
-
-  if (Call.isCalled(CD_alloca, CD_win_alloca))
+bool MallocChecker::isMemCall(const CallEvent &Call) const {
+  if (FreeingMemFnMap.lookup(Call) || NonFreeingMemFnMap.lookup(Call))
----------------
It may be more precise to call this `isCMemCall`, because that's the question it answers.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1487
 
-  if (Att->getModule()->getName() !=
-      MemFunctionInfo.CD_malloc.getFunctionName())
+  if (Att->getModule()->getName() != "malloc")
     return nullptr;
----------------
Ugh, no idea whats happening here, I'll be honest. I sweat to dig a bit deeper to find out, though I didn't want to bother delaying the publishing this patch for a feature not documented, or used anywhere.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68165/new/

https://reviews.llvm.org/D68165





More information about the cfe-commits mailing list