segfault while calculating post-dominator tree

Hi all!

I am trying to caclulate the post-dominance tree of a given cfg.

Since clang::DominatorTree class is for calculating the dominance tree (not
post-dominance) I did the following:

class methodAnalyser{
public:
  methodAnalyser(const FunctionDecl *FD){

    manager = new AnalysisDeclContextManager();
    analysis = new AnalysisDeclContext(&manager, FD);
    DT = new llvm::DominatorTreeBase<CFGBlock>(true);//argument 'true'
indicates we are interested in POST-dominance tree.

    cfg = analysis->getCFG();
    DT->recalculate(*cfg);
  }

protected:
  CFG *cfg;
  llvm::DominatorTreeBase<CFGBlock> *DT;
  AnalysisDeclContextManager manager;
  AnalysisDeclContext *analysis;
};

While for some (non trivial) programs the above approach works fine there
are cases where DT->recalculate(*cfg) segfaults.

One thing I found is that this happens when an edge in the cfg is marked as
'non-reachable' (basic block contains a statement that is marked as
'no-return').

I am interested in calculating the post-dominance tree for nodes that *are
reachable* from the start of a program so is there a way to create a cfg
without 'non-reachable' edges etc... ? If not, is there a completelly
different approach for calculating the post-dominance tree or I have to
implement my own algorithm ?

Thank you very much!