mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-25 13:27:52 +00:00
[ThinLTO] Fix Windows debug failure in new iterator
This fixes a debug assert on Windows from the new iterator implementation added in r269059. The Windows std::vector iterator operator== checks in debug mode that the containers being iterated over are the same, which they may not be. Fixed by checking that we are iterating over the same container before comparing the container iterators. llvm-svn: 269232
This commit is contained in:
parent
f28ce785a9
commit
8a23fb7cb0
@ -333,21 +333,24 @@ public:
|
|||||||
// is empty. This will be handled specially in operator== as well.
|
// is empty. This will be handled specially in operator== as well.
|
||||||
if (Writer.ModuleToSummariesForIndex &&
|
if (Writer.ModuleToSummariesForIndex &&
|
||||||
!Writer.ModuleToSummariesForIndex->empty()) {
|
!Writer.ModuleToSummariesForIndex->empty()) {
|
||||||
ModuleSummariesIter = Writer.ModuleToSummariesForIndex->begin();
|
|
||||||
for (ModuleSummariesBack = Writer.ModuleToSummariesForIndex->begin();
|
for (ModuleSummariesBack = Writer.ModuleToSummariesForIndex->begin();
|
||||||
std::next(ModuleSummariesBack) !=
|
std::next(ModuleSummariesBack) !=
|
||||||
Writer.ModuleToSummariesForIndex->end();
|
Writer.ModuleToSummariesForIndex->end();
|
||||||
ModuleSummariesBack++)
|
ModuleSummariesBack++)
|
||||||
;
|
;
|
||||||
|
ModuleSummariesIter = !IsAtEnd
|
||||||
|
? Writer.ModuleToSummariesForIndex->begin()
|
||||||
|
: ModuleSummariesBack;
|
||||||
ModuleGVSummariesIter = !IsAtEnd ? ModuleSummariesIter->second.begin()
|
ModuleGVSummariesIter = !IsAtEnd ? ModuleSummariesIter->second.begin()
|
||||||
: ModuleSummariesBack->second.end();
|
: ModuleSummariesBack->second.end();
|
||||||
} else if (!Writer.ModuleToSummariesForIndex &&
|
} else if (!Writer.ModuleToSummariesForIndex &&
|
||||||
Writer.Index.begin() != Writer.Index.end()) {
|
Writer.Index.begin() != Writer.Index.end()) {
|
||||||
IndexSummariesIter = Writer.Index.begin();
|
|
||||||
for (IndexSummariesBack = Writer.Index.begin();
|
for (IndexSummariesBack = Writer.Index.begin();
|
||||||
std::next(IndexSummariesBack) != Writer.Index.end();
|
std::next(IndexSummariesBack) != Writer.Index.end();
|
||||||
IndexSummariesBack++)
|
IndexSummariesBack++)
|
||||||
;
|
;
|
||||||
|
IndexSummariesIter =
|
||||||
|
!IsAtEnd ? Writer.Index.begin() : IndexSummariesBack;
|
||||||
IndexGVSummariesIter = !IsAtEnd ? IndexSummariesIter->second.begin()
|
IndexGVSummariesIter = !IsAtEnd ? IndexSummariesIter->second.begin()
|
||||||
: IndexSummariesBack->second.end();
|
: IndexSummariesBack->second.end();
|
||||||
}
|
}
|
||||||
@ -398,6 +401,10 @@ public:
|
|||||||
// empty, they both are.
|
// empty, they both are.
|
||||||
if (Writer.ModuleToSummariesForIndex->empty())
|
if (Writer.ModuleToSummariesForIndex->empty())
|
||||||
return true;
|
return true;
|
||||||
|
// Ensure the ModuleGVSummariesIter are iterating over the same
|
||||||
|
// container before checking them below.
|
||||||
|
if (ModuleSummariesIter != RHS.ModuleSummariesIter)
|
||||||
|
return false;
|
||||||
return ModuleGVSummariesIter == RHS.ModuleGVSummariesIter;
|
return ModuleGVSummariesIter == RHS.ModuleGVSummariesIter;
|
||||||
}
|
}
|
||||||
// First ensure RHS also writing the full index, and that both are
|
// First ensure RHS also writing the full index, and that both are
|
||||||
@ -409,6 +416,10 @@ public:
|
|||||||
// empty, they both are.
|
// empty, they both are.
|
||||||
if (Writer.Index.begin() == Writer.Index.end())
|
if (Writer.Index.begin() == Writer.Index.end())
|
||||||
return true;
|
return true;
|
||||||
|
// Ensure the IndexGVSummariesIter are iterating over the same
|
||||||
|
// container before checking them below.
|
||||||
|
if (IndexSummariesIter != RHS.IndexSummariesIter)
|
||||||
|
return false;
|
||||||
return IndexGVSummariesIter == RHS.IndexGVSummariesIter;
|
return IndexGVSummariesIter == RHS.IndexGVSummariesIter;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user