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.
- 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.
Praise clangd! This is why the buildbots broke :) checkIfNewOrNewArrayFamily doesn't return false in all cases.