Fix a few mismatched iterator types revealed from a libc++ + LLVM_EXPENSIVE_CHECKS build

These were accidental SCARY iterator uses that weren't guaranteed and in
libc++'s debug checking mode were actually distinct types. Use decltype
to make it easier to keep these things up to date.
This commit is contained in:
David Blaikie 2020-04-10 10:11:29 -07:00
parent 7f38812d5b
commit 67a2cc80b6
2 changed files with 3 additions and 4 deletions

View File

@ -855,8 +855,8 @@ public:
// Iterators for target-dependent attributes.
using td_type = std::pair<std::string, std::string>;
using td_iterator = std::map<std::string, std::string>::iterator;
using td_const_iterator = std::map<std::string, std::string>::const_iterator;
using td_iterator = decltype(TargetDepAttrs)::iterator;
using td_const_iterator = decltype(TargetDepAttrs)::const_iterator;
using td_range = iterator_range<td_iterator>;
using td_const_range = iterator_range<td_const_iterator>;

View File

@ -80,8 +80,7 @@ public:
/// Return a collection of the linked unique remarks to iterate on.
/// Ex:
/// for (const Remark &R : RL.remarks() { [...] }
using iterator =
pointee_iterator<std::set<std::unique_ptr<Remark>>::iterator>;
using iterator = pointee_iterator<decltype(Remarks)::const_iterator>;
iterator_range<iterator> remarks() const {
return {Remarks.begin(), Remarks.end()};