mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
06717a6185
Import the RestructureCFGPass from the `feature/the-comb` branch on the `revamb` repository.
47 lines
987 B
C++
47 lines
987 B
C++
#ifndef ASTTREE_H
|
|
#define ASTTREE_H
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
// Standard includes
|
|
#include <cstdlib>
|
|
|
|
// Local includes
|
|
#include "ASTNode.h"
|
|
|
|
class ASTTree {
|
|
|
|
public:
|
|
using links_container = std::vector<std::unique_ptr<ASTNode>>;
|
|
using links_iterator = typename links_container::iterator;
|
|
using links_range = llvm::iterator_range<links_iterator>;
|
|
|
|
links_iterator begin() { return links_iterator(ASTNodeList.begin()); };
|
|
links_iterator end() { return links_iterator(ASTNodeList.end()); };
|
|
|
|
private:
|
|
std::map<BasicBlockNode *, std::unique_ptr<ASTNode>> NodeASTMap;
|
|
links_container ASTNodeList;
|
|
|
|
public:
|
|
|
|
void addCFGNode() {}
|
|
|
|
SequenceNode *addSequenceNode();
|
|
|
|
links_range nodes() {
|
|
return llvm::make_range(begin(), end());
|
|
}
|
|
|
|
size_t size();
|
|
|
|
void addASTNode(BasicBlockNode *Node, std::unique_ptr<ASTNode>&& ASTObject);
|
|
|
|
ASTNode *findASTNode(BasicBlockNode *BlockNode);
|
|
|
|
};
|
|
|
|
#endif // ASTTREE_H
|