[PATCH] D54823: [analyzer][MallocChecker][NFC] Document and reorganize some functions

Umann Kristóf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 21 18:03:03 PST 2018


Szelethus created this revision.
Szelethus added reviewers: NoQ, george.karpenkov, xazax.hun, rnkovacs.
Herald added subscribers: cfe-commits, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, whisperity.

I'm in the process of splitting this checker into multiple other ones, and while I was there, I provided documentation to most functions, and made some static, and in some cases moved them out of class.

This patch merely reorganizes some things, and features no functional change.

In detail:

- Provided documentation, or moved existing documentation in more obvious places.
- Added dividers. (the `//===----------===//` thing).
- Moved `getAllocationFamily`, `printAllocDeallocName`, `printExpectedAllocName` and `printExpectedDeallocName` in the global namespace on top of the file where `AllocationFamily` is declared, as they are very strongly related.
- Realloc modeling was very poor in terms of variable and structure naming, as well as documentation, so I renamed some of them and added much needed docs.
- Moved function `IdentifierInfo`s to a separate struct, and moved `isMemFunction`, `isCMemFunction` adn `isStandardNewDelete` inside it. This makes the patch affect quite a lot of lines, should I extract it to a separate one?
- Moved `MallocBugVisitor` out of `MallocChecker`.
- Preferred switches to long else-if branches in some places.
- Neatly organized some `RUN:` lines.


Repository:
  rC Clang

https://reviews.llvm.org/D54823

Files:
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  test/Analysis/malloc.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54823.175006.patch
Type: text/x-patch
Size: 77708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181122/11503e1d/attachment-0001.bin>


More information about the cfe-commits mailing list