-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* use template in WTO * explicit CFBasicBlockGWTO and ICFGWTO * add typedef wtonode and fix virtual functions called within constructor * refactor * refactor
- Loading branch information
Showing
12 changed files
with
1,033 additions
and
915 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
//===- CFBasicBlockGWTO.h -- WTO for CFBasicBlockGraph----------------------// | ||
// | ||
// SVF: Static Value-Flow Analysis | ||
// | ||
// Copyright (C) <2013-> <Yulei Sui> | ||
// | ||
|
||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
/* | ||
* CFBasicBlockGWTO.h | ||
* | ||
* The implementation is based on F. Bourdoncle's paper: | ||
* "Efficient chaotic iteration strategies with widenings", Formal | ||
* Methods in Programming and Their Applications, 1993, pages 128-141. | ||
* | ||
* Created on: Jan 22, 2024 | ||
* Author: Xiao Cheng | ||
* | ||
*/ | ||
#ifndef SVF_CFBASICBLOCKGWTO_H | ||
#define SVF_CFBASICBLOCKGWTO_H | ||
#include "Graphs/CFBasicBlockG.h" | ||
#include "Graphs/WTO.h" | ||
|
||
namespace SVF | ||
{ | ||
typedef WTOComponent<CFBasicBlockGraph> CFBasicBlockGWTOComp; | ||
typedef WTONode<CFBasicBlockGraph> CFBasicBlockGWTONode; | ||
typedef WTOCycle<CFBasicBlockGraph> CFBasicBlockGWTOCycle; | ||
|
||
class CFBasicBlockGWTO : public WTO<CFBasicBlockGraph> | ||
{ | ||
public: | ||
typedef WTO<CFBasicBlockGraph> Base; | ||
typedef WTOComponentVisitor<CFBasicBlockGraph>::WTONodeT | ||
CFBasicBlockGWTONode; | ||
|
||
explicit CFBasicBlockGWTO(CFBasicBlockGraph* graph, | ||
const CFBasicBlockNode* node) | ||
: Base(graph, node) | ||
{ | ||
} | ||
|
||
inline void forEachSuccessor( | ||
const CFBasicBlockNode* node, | ||
std::function<void(const CFBasicBlockNode*)> func) const override | ||
{ | ||
if (const auto* callNode = | ||
SVFUtil::dyn_cast<CallICFGNode>(node->getICFGNodes().front())) | ||
{ | ||
const CFBasicBlockNode* succ = _graph->getCFBasicBlockNode( | ||
callNode->getRetICFGNode()->getId()); | ||
func(succ); | ||
} | ||
else | ||
{ | ||
for (const auto& e : node->getOutEdges()) | ||
{ | ||
if (e->getICFGEdge() && | ||
(!e->getICFGEdge()->isIntraCFGEdge() || | ||
node->getFunction() != e->getDstNode()->getFunction())) | ||
continue; | ||
func(e->getDstNode()); | ||
} | ||
} | ||
} | ||
}; | ||
} // namespace SVF | ||
#endif // SVF_CFBASICBLOCKGWTO_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
//===--------------- ICFGWTO.h -- WTO for ICFG----------------------// | ||
// | ||
// SVF: Static Value-Flow Analysis | ||
// | ||
// Copyright (C) <2013-> <Yulei Sui> | ||
// | ||
|
||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
/* | ||
* ICFGWTO.h | ||
* | ||
* The implementation is based on F. Bourdoncle's paper: | ||
* "Efficient chaotic iteration strategies with widenings", Formal | ||
* Methods in Programming and Their Applications, 1993, pages 128-141. | ||
* | ||
* Created on: Jan 22, 2024 | ||
* Author: Xiao Cheng | ||
* | ||
*/ | ||
#ifndef SVF_ICFGWTO_H | ||
#define SVF_ICFGWTO_H | ||
|
||
#include "Graphs/ICFG.h" | ||
#include "Graphs/WTO.h" | ||
|
||
namespace SVF | ||
{ | ||
|
||
typedef WTOComponent<ICFG> ICFGWTOComp; | ||
typedef WTONode<ICFG> ICFGWTONode; | ||
typedef WTOCycle<ICFG> ICFGWTOCycle; | ||
|
||
class ICFGWTO : public WTO<ICFG> | ||
{ | ||
public: | ||
typedef WTO<ICFG> Base; | ||
typedef WTOComponentVisitor<ICFG>::WTONodeT ICFGWTONode; | ||
|
||
explicit ICFGWTO(ICFG* graph, const ICFGNode* node) : Base(graph, node) {} | ||
|
||
inline void forEachSuccessor( | ||
const ICFGNode* node, | ||
std::function<void(const ICFGNode*)> func) const override | ||
{ | ||
if (const auto* callNode = SVFUtil::dyn_cast<CallICFGNode>(node)) | ||
{ | ||
const ICFGNode* succ = callNode->getRetICFGNode(); | ||
func(succ); | ||
} | ||
else | ||
{ | ||
for (const auto& e : node->getOutEdges()) | ||
{ | ||
if (!e->isIntraCFGEdge() || | ||
node->getFun() != e->getDstNode()->getFun()) | ||
continue; | ||
func(e->getDstNode()); | ||
} | ||
} | ||
} | ||
}; | ||
} // namespace SVF | ||
|
||
#endif // SVF_ICFGWTO_H |
Oops, something went wrong.