diff options
author | Reid Kleckner <rnk@google.com> | 2019-11-07 10:37:04 -0800 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2019-11-07 10:39:29 -0800 |
commit | dd870f6929ee0b1dfb5fd000c7b826a1bd2d2571 (patch) | |
tree | 1631b0cea48c629bd020937105dd5bd24ce8f66c | |
parent | 6e655e58bc748d631fac90d969e77ceb04b884db (diff) | |
download | bcm5719-llvm-dd870f6929ee0b1dfb5fd000c7b826a1bd2d2571.tar.gz bcm5719-llvm-dd870f6929ee0b1dfb5fd000c7b826a1bd2d2571.zip |
Fix warning about unused std::unique result, erase shifted elements
This is actually a functional change. I haven't added any new test
coverage. I'm just trying to fix the warning and hoping for the best.
-rw-r--r-- | clang/include/clang/Serialization/ContinuousRangeMap.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/clang/include/clang/Serialization/ContinuousRangeMap.h b/clang/include/clang/Serialization/ContinuousRangeMap.h index 0c05537dd10..c2665c09741 100644 --- a/clang/include/clang/Serialization/ContinuousRangeMap.h +++ b/clang/include/clang/Serialization/ContinuousRangeMap.h @@ -118,14 +118,17 @@ public: ~Builder() { llvm::sort(Self.Rep, Compare()); - std::unique(Self.Rep.begin(), Self.Rep.end(), - [](const_reference A, const_reference B) { - // FIXME: we should not allow any duplicate keys, but there are a lot of - // duplicate 0 -> 0 mappings to remove first. - assert((A == B || A.first != B.first) && - "ContinuousRangeMap::Builder given non-unique keys"); - return A == B; - }); + Self.Rep.erase( + std::unique( + Self.Rep.begin(), Self.Rep.end(), + [](const_reference A, const_reference B) { + // FIXME: we should not allow any duplicate keys, but there are + // a lot of duplicate 0 -> 0 mappings to remove first. + assert((A == B || A.first != B.first) && + "ContinuousRangeMap::Builder given non-unique keys"); + return A == B; + }), + Self.Rep.end()); } void insert(const value_type &Val) { |