Please see the reason for this redesign in the patch D91324.
Basically the checker introduces an internal custom CFG analysis that tracks current up-to date CFG snapshot. The analysis is invalidated along with any other CFG related analysis (the key is CFGAnalyses). If the CFG analysis is not invalidated at a functional pass exit then the checker asserts that the CFG snapshot taken from this analysis is equals to a snapshot of the current CFG.
Along the way:
- the function CFG::printDiff() is simplified by removing function name calculation. The name is printed by the caller;
- fixed CFG invalidated condition (see CFG::invalidate());
- StandardInstrumentations::registerCallbacks() gets additional optional parameter of type FunctionAnalysisManager*, which is needed by the checker to get the custom CFG analysis;
- several PM related tests updated to explicitly set -verify-cfg-preserved as they need.
This patch is safe to land as the CFGChecker is left switched off (the options -verify-cfg-preserved is false by default). It will be switched on by a separate patch to minimize possible reverts.