[PATCH] D75430: [analyzer][NFC] Introduce CXXDeallocatorCall, deploy it in MallocChecker

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 1 16:32:28 PST 2020


Szelethus created this revision.
Szelethus added reviewers: balazske, martong, NoQ, xazax.hun, rnkovacs, dcoughlin, baloghadamsoftware.
Herald added subscribers: cfe-commits, steakhal, Charusso, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, szepet, whisperity.
Herald added a project: clang.
Szelethus added a parent revision: D68165: [analyzer][MallocChecker][NFC] Split checkPostCall up, deploy CallDescriptionMap.

This is my first ever patch touching `ExprEngine`, sorry if the code causes lasting damage to the reader.

One of the pain points in simplifying `MallocChecker`s interface by gradually changing to `CallEvent` is that a variety of C++ allocation and deallocation functionalities are modeled through `preStmt<...>` where `CallEvent` is unavailable, and a single one of these callbacks can prevent a mass parameter change.

This patch introduces a new `CallEvent`, `CXXDeallocatorCall`, which happens //after// `preStmt<CXXDeleteExpr>`, and can completely replace that callback as demonstrated. Note how you can retrieve this call through `preCall`, yet there is no `postCall` to pair it with -- the reason behind this is that neither does `preStmt<CXXDeleteExpr>` have a `postStmt<CXXDeleteExpr>` pair. But I have no clue why that is :^)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75430

Files:
  clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
  clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
  clang/lib/StaticAnalyzer/Checkers/AnalysisOrderChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
  clang/test/Analysis/analyzer-config.c
  clang/test/Analysis/operator-delete-analysis-order.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75430.247528.patch
Type: text/x-patch
Size: 14887 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200302/a1f5c299/attachment.bin>


More information about the cfe-commits mailing list