mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-28 08:16:05 +00:00
Revert "CFGDiff: Simplify/common the begin/end implementations to use a common range helper"
This reverts commit 79a7ed92a9b135212a6a271dd8dbc625038c8f06. This breaks the asan buildbot.
This commit is contained in:
parent
157d5e9a63
commit
09d2d2b02c
@ -158,42 +158,58 @@ template <typename GraphT, bool InverseGraph = false, bool InverseEdge = false,
|
||||
typename GT = GraphTraits<GraphT>>
|
||||
struct CFGViewChildren {
|
||||
using DataRef = const GraphDiff<typename GT::NodeRef, InverseGraph> *;
|
||||
using NodeRef = std::pair<DataRef, typename GT::NodeRef>;
|
||||
using RawNodeRef = typename GT::NodeRef;
|
||||
using NodeRef = std::pair<DataRef, RawNodeRef>;
|
||||
|
||||
template<typename Range>
|
||||
static auto makeChildRange(Range &&R, DataRef DR) {
|
||||
using Iter = WrappedPairNodeDataIterator<decltype(std::forward<Range>(R).begin()), NodeRef, DataRef>;
|
||||
return make_range(Iter(R.begin(), DR), Iter(R.end(), DR));
|
||||
}
|
||||
using ExistingChildIterator =
|
||||
WrappedPairNodeDataIterator<typename GT::ChildIteratorType, NodeRef,
|
||||
DataRef>;
|
||||
struct DeletedEdgesFilter {
|
||||
RawNodeRef BB;
|
||||
DeletedEdgesFilter(RawNodeRef BB) : BB(BB){};
|
||||
bool operator()(NodeRef N) const {
|
||||
return !N.first->ignoreChild(BB, N.second, InverseEdge);
|
||||
}
|
||||
};
|
||||
using FilterExistingChildrenIterator =
|
||||
filter_iterator<ExistingChildIterator, DeletedEdgesFilter>;
|
||||
|
||||
static auto children(NodeRef N) {
|
||||
using vec_iterator = typename SmallVectorImpl<RawNodeRef>::const_iterator;
|
||||
using AddNewChildrenIterator =
|
||||
WrappedPairNodeDataIterator<vec_iterator, NodeRef, DataRef>;
|
||||
using ChildIteratorType =
|
||||
concat_iterator<NodeRef, FilterExistingChildrenIterator,
|
||||
AddNewChildrenIterator>;
|
||||
|
||||
// filter iterator init:
|
||||
auto R = make_range(GT::child_begin(N.second), GT::child_end(N.second));
|
||||
auto First = make_filter_range(makeChildRange(R, N.first), [&](NodeRef C) {
|
||||
return !C.first->ignoreChild(N.second, C.second, InverseEdge);
|
||||
});
|
||||
|
||||
// new inserts iterator init:
|
||||
static ChildIteratorType child_begin(NodeRef N) {
|
||||
auto InsertVec = N.first->getAddedChildren(N.second, InverseEdge);
|
||||
auto Second = makeChildRange(InsertVec, N.first);
|
||||
// filter iterator init:
|
||||
auto firstit = make_filter_range(
|
||||
make_range<ExistingChildIterator>({GT::child_begin(N.second), N.first},
|
||||
{GT::child_end(N.second), N.first}),
|
||||
DeletedEdgesFilter(N.second));
|
||||
// new inserts iterator init:
|
||||
auto secondit = make_range<AddNewChildrenIterator>(
|
||||
{InsertVec.begin(), N.first}, {InsertVec.end(), N.first});
|
||||
|
||||
auto CR = concat<NodeRef>(First, Second);
|
||||
// concat_range contains references to other ranges, returning it would
|
||||
// leave those references dangling - the iterators contain
|
||||
// other iterators by value so they're safe to return.
|
||||
return make_range(CR.begin(), CR.end());
|
||||
return concat_iterator<NodeRef, FilterExistingChildrenIterator,
|
||||
AddNewChildrenIterator>(firstit, secondit);
|
||||
}
|
||||
|
||||
static auto child_begin(NodeRef N) {
|
||||
return children(N).begin();
|
||||
}
|
||||
static ChildIteratorType child_end(NodeRef N) {
|
||||
auto InsertVec = N.first->getAddedChildren(N.second, InverseEdge);
|
||||
// filter iterator init:
|
||||
auto firstit = make_filter_range(
|
||||
make_range<ExistingChildIterator>({GT::child_end(N.second), N.first},
|
||||
{GT::child_end(N.second), N.first}),
|
||||
DeletedEdgesFilter(N.second));
|
||||
// new inserts iterator init:
|
||||
auto secondit = make_range<AddNewChildrenIterator>(
|
||||
{InsertVec.end(), N.first}, {InsertVec.end(), N.first});
|
||||
|
||||
static auto child_end(NodeRef N) {
|
||||
return children(N).end();
|
||||
return concat_iterator<NodeRef, FilterExistingChildrenIterator,
|
||||
AddNewChildrenIterator>(firstit, secondit);
|
||||
}
|
||||
|
||||
using ChildIteratorType = decltype(child_end(std::declval<NodeRef>()));
|
||||
};
|
||||
|
||||
template <typename T, bool B>
|
||||
|
Loading…
x
Reference in New Issue
Block a user