[cfe-dev] segfault while calculating post-dominator tree
Greenwalker
panagos13 at hotmail.com
Sun Jul 6 11:25:56 PDT 2014
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!
--
View this message in context: http://clang-developers.42468.n3.nabble.com/segfault-while-calculating-post-dominator-tree-tp4040376.html
Sent from the Clang Developers mailing list archive at Nabble.com.
More information about the cfe-dev
mailing list