Skip to content

Commit

Permalink
add CallCFGEdge::getCallSite method
Browse files Browse the repository at this point in the history
  • Loading branch information
yuleisui committed Sep 17, 2024
1 parent 58db851 commit 0059690
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions svf/include/Graphs/ICFGEdge.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ class CallCFGEdge : public ICFGEdge
{
callPEs.push_back(callPE);
}
/// Return call ICFGNode at the callsite
inline const CallICFGNode* getCallSite() const
{
assert(SVFUtil::isa<CallICFGNode>(getSrcNode()) && "not a CallICFGNode?");
return SVFUtil::cast<CallICFGNode>(getSrcNode());
}
/// Add get parameter edge to this CallCFGEdge
inline const std::vector<const CallPE*>& getCallPEs() const
{
Expand Down Expand Up @@ -243,6 +249,9 @@ class RetCFGEdge : public ICFGEdge
{
return retPE;
}
/// Return call ICFGNode at the callsite
const CallICFGNode* getCallSite() const;

/// Methods for support type inquiry through isa, cast, and dyn_cast:
//@{
static inline bool classof(const RetCFGEdge*)
Expand Down
7 changes: 7 additions & 0 deletions svf/lib/Graphs/ICFG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ const std::string RetCFGEdge::toString() const
return rawstr.str();
}

/// Return call ICFGNode at the callsite
const CallICFGNode* RetCFGEdge::getCallSite() const
{
assert(SVFUtil::isa<RetICFGNode>(getDstNode()) && "not a RetICFGNode?");
return SVFUtil::cast<RetICFGNode>(getDstNode())->getCallICFGNode();
}

/*!
* Constructor
* * Build ICFG
Expand Down

0 comments on commit 0059690

Please sign in to comment.