Static Value-Flow Analysis
ICFGWTO.h
Go to the documentation of this file.
1 //===--------------- ICFGWTO.h -- WTO for ICFG----------------------//
2 //
3 // SVF: Static Value-Flow Analysis
4 //
5 // Copyright (C) <2013-> <Yulei Sui>
6 //
7 
8 // This program is free software: you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or
11 // (at your option) any later version.
12 
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 
18 // You should have received a copy of the GNU General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 //
21 //===----------------------------------------------------------------------===//
22 
23 /*
24  * ICFGWTO.h
25  *
26  * The implementation is based on F. Bourdoncle's paper:
27  * "Efficient chaotic iteration strategies with widenings", Formal
28  * Methods in Programming and Their Applications, 1993, pages 128-141.
29  *
30  * Created on: Jan 22, 2024
31  * Author: Xiao Cheng
32  *
33  */
34 #ifndef SVF_ICFGWTO_H
35 #define SVF_ICFGWTO_H
36 
37 #include "Graphs/ICFG.h"
38 #include "Graphs/WTO.h"
39 
40 namespace SVF
41 {
42 
46 
47 class ICFGWTO : public WTO<ICFG>
48 {
49 public:
50  typedef WTO<ICFG> Base;
52 
53  explicit ICFGWTO(ICFG* graph, const ICFGNode* node) : Base(graph, node) {}
54 
55  virtual ~ICFGWTO()
56  {
57  }
58 
59  inline void forEachSuccessor(
60  const ICFGNode* node,
61  std::function<void(const ICFGNode*)> func) const override
62  {
63  if (const auto* callNode = SVFUtil::dyn_cast<CallICFGNode>(node))
64  {
65  const ICFGNode* succ = callNode->getRetICFGNode();
66  func(succ);
67  }
68  else
69  {
70  for (const auto& e : node->getOutEdges())
71  {
72  if (!e->isIntraCFGEdge() ||
73  node->getFun() != e->getDstNode()->getFun())
74  continue;
75  func(e->getDstNode());
76  }
77  }
78  }
79 };
80 } // namespace SVF
81 
82 #endif // SVF_ICFGWTO_H
const GEdgeSetTy & getOutEdges() const
Definition: GenericGraph.h:430
virtual const SVFFunction * getFun() const
Return the function of this ICFGNode.
Definition: ICFGNode.h:76
void forEachSuccessor(const ICFGNode *node, std::function< void(const ICFGNode *)> func) const override
Definition: ICFGWTO.h:59
virtual ~ICFGWTO()
Definition: ICFGWTO.h:55
ICFGWTO(ICFG *graph, const ICFGNode *node)
Definition: ICFGWTO.h:53
WTO< ICFG > Base
Definition: ICFGWTO.h:50
WTOComponentVisitor< ICFG >::WTONodeT ICFGWTONode
Definition: ICFGWTO.h:51
Definition: ICFG.h:48
Definition: WTO.h:517
for isBitcode
Definition: BasicTypes.h:68
WTOCycle< ICFG > ICFGCycleWTO
Definition: ICFGWTO.h:45
WTONode< ICFG > ICFGSingletonWTO
Definition: ICFGWTO.h:44
WTOComponent< ICFG > ICFGWTOComp
Definition: ICFGWTO.h:43