43 for (CHEdge::CHEdgeSetTy::const_iterator it = src->
getOutEdges().begin(),
46 CHNode *node = (*it)->getDstNode();
48 if (node == dst && edgeType == et)
61 for (
unsigned i = 1; i < arg_size; i++)
64 auto fn_arg = fn->
getArg(i);
65 if (cs_arg->getType() != fn_arg->getType())
103 assert(srcNode && dstNode &&
"node not found?");
105 if (!
hasEdge(srcNode, dstNode, edgeType))
134 if (
child ==
nullptr)
137 child->getVirtualFunctions(idx, vfns);
138 for (CHNode::FuncVector::const_iterator fit = vfns.begin(),
139 feit = vfns.end(); fit != feit; ++fit)
151 string calleeName = callee->
getName();
162 const std::string suffix(
"[abi:cxx11]");
163 size_t suffix_pos = calleeName.rfind(suffix);
164 if (suffix_pos != string::npos)
165 calleeName.erase(suffix_pos, suffix.size());
171 if (funName.size() == 0)
173 virtualFunctions.insert(callee);
175 else if (funName[0] ==
'~')
187 if (calleeName[0] ==
'~')
189 virtualFunctions.insert(callee);
198 if (funName.compare(calleeName) == 0)
200 virtualFunctions.insert(callee);
214 if ((*it).size() > idx)
215 virtualFunctions.push_back((*it)[idx]);
224 const CHNode *node = it->second;
226 for (CHEdge::CHEdgeSetTy::const_iterator it = node->
OutEdgeBegin();
230 outs() << (*it)->getDstNode()->getName() <<
" --inheritance--> "
231 << (*it)->getSrcNode()->getName() <<
"\n";
233 outs() << (*it)->getSrcNode()->getName() <<
" --instance--> "
234 << (*it)->getDstNode()->getName() <<
"\n";
273 return "Class Hierarchy Graph";
291 template<
class EdgeIter>
295 CHEdge* edge = *(EI.getCurrent());
296 assert(edge &&
"No edge found!!");
299 return "style=solid";
303 return "style=dashed";
static bool hasEdge(const CHNode *src, const CHNode *dst, CHEdge::CHEDGETYPE et)
static bool checkArgTypes(const CallICFGNode *cs, const FunObjVar *fn)
CHEDGETYPE getEdgeType() const
CallNodeToVFunSetMap callNodeToCHAVFnsMap
void dump(const std::string &filename)
bool csHasVtblsBasedonCHA(const CallICFGNode *cs) override
void addEdge(const std::string className, const std::string baseClassName, CHEdge::CHEDGETYPE edgeType)
bool csHasVFnsBasedonCHA(const CallICFGNode *cs) override
const VFunSet & getCSVFsBasedonCHA(const CallICFGNode *cs) override
const VTableSet & getCSVtblsBasedonCHA(const CallICFGNode *cs) override
void getVFnsFromVtbls(const CallICFGNode *cs, const VTableSet &vtbls, VFunSet &virtualFunctions) override
CHNode * getNode(const std::string name) const
Map< std::string, CHNode * > classNameToNodeMap
CallNodeToVTableSetMap callNodeToCHAVtblsMap
virtual const std::string & getName() const
void getVirtualFunctions(u32_t idx, FuncVector &virtualFunctions) const
bool isPureAbstract() const
std::vector< FuncVector > virtualFunctionVectors
std::vector< const FunObjVar * > FuncVector
const ValVar * getArgument(u32_t ArgNo) const
Parameter operations.
s32_t getFunIdxInVtable() const
const std::string & getFunNameOfVirtualCall() const
const ArgValVar * getArg(u32_t idx) const
IDToNodeMapTy::const_iterator const_iterator
const GEdgeSetTy & getOutEdges() const
bool addIncomingEdge(EdgeType *inEdge)
Add incoming and outgoing edges.
iterator OutEdgeBegin()
iterators
bool addOutgoingEdge(EdgeType *outEdge)
static void WriteGraphToFile(SVF::OutStream &O, const std::string &GraphName, const GraphType >, bool simple=false)
virtual const std::string & getName() const
std::ostream & outs()
Overwrite llvm::outs().
void ViewGraph(const GraphType &G, const std::string &name, bool ShortNames=false, GraphProgram::Name Program=GraphProgram::DOT)
Set< const GlobalObjVar * > VTableSet
Set< const FunObjVar * > VFunSet
DOTGraphTraits(bool isSimple=false)
static std::string getNodeLabel(CHNode *node, CHGraph *)
Return function name;.
static std::string getGraphName(CHGraph *)
Return name of the graph.
static std::string getNodeAttributes(CHNode *node, CHGraph *)
static std::string getEdgeAttributes(CHNode *, EdgeIter EI, CHGraph *)
DefaultDOTGraphTraits(bool simple=false)