[IDF] Generalize IDFCalculator to be used with Clang's CFG
authorKristof Umann <dkszelethus@gmail.com>
Tue, 2 Jul 2019 11:30:12 +0000 (11:30 +0000)
committerKristof Umann <dkszelethus@gmail.com>
Tue, 2 Jul 2019 11:30:12 +0000 (11:30 +0000)
commit2087b6adba6f584a2c984619508c04c40ebfd911
treef9c276303f9b94e57aec1f367741ab49e39e79e5
parente2cc9930dd1eae80aad2d3cb7ed6b32c83729472
[IDF] Generalize IDFCalculator to be used with Clang's CFG

I'm currently working on a GSoC project that aims to improve the the bug reports
of the analyzer. The main heuristic I plan to use is to explain values that are
a control dependency of the bug location better.

01 bool b = messyComputation();
02 int i = 0;
03 if (b) // control dependency of the bug site, let's explain why we assume val
04        // to be true
05   10 / i; // warn: division by zero

Because of this, I'd like to generalize IDFCalculator so that I could use it for
Clang's CFG: D62883.

In detail:

* Rename IDFCalculator to IDFCalculatorBase, make it take a general CFG node
  type as a template argument rather then strictly BasicBlock (but preserve
  ForwardIDFCalculator and ReverseIDFCalculator)
* Move IDFCalculatorBase from llvm/include/llvm/Analysis to
  llvm/include/llvm/Support (but leave the BasicBlock variants in
  llvm/include/llvm/Analysis)
* clang-format the file since this patch messes up git blame anyways
* Change typedef to using
* Add the new type ChildrenGetterTy, and store an instance of it in
  IDFCalculatorBase. This is important because I'll have to specialize it for
  Clang's CFG to filter out nullpointer successors, similarly to D62507.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364911 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/IteratedDominanceFrontier.h
include/llvm/Support/GenericIteratedDominanceFrontier.h [new file with mode: 0644]
lib/Analysis/CMakeLists.txt
lib/Analysis/IteratedDominanceFrontier.cpp [deleted file]