[analyzer][MallocChecker][NFC] Document and reorganize some functions
authorKristof Umann <dkszelethus@gmail.com>
Sat, 15 Dec 2018 18:34:00 +0000 (18:34 +0000)
committerKristof Umann <dkszelethus@gmail.com>
Sat, 15 Dec 2018 18:34:00 +0000 (18:34 +0000)
commitcf6bb77f65f00251e137dcd5147d78fbd836b9fe
tree13020e31f142a07f61a03e560528c747da03c8b1
parentb0be2ab4d0c6838f20b670f2186aefb3859e6e05
[analyzer][MallocChecker][NFC] Document and reorganize some functions

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.
* Moved isReleased and MallocUpdateRefState near RefState's definition for the
same reason.
* 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 IdentifierInfos 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.

Differential Revision: https://reviews.llvm.org/D54823

llvm-svn: 349281
clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
clang/test/Analysis/malloc-annotations.c
clang/test/Analysis/malloc.c