[PATCH] D136702: [llvm-cov] Look up object files using debuginfod

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 28 22:37:16 PST 2023


dblaikie added inline comments.


================
Comment at: llvm/lib/ProfileData/Coverage/CoverageMapping.cpp:421
+    llvm::sort(ProfileBinaryIDs, Compare);
+    std::unique(ProfileBinaryIDs.begin(), ProfileBinaryIDs.end(), Compare);
+
----------------
mysterymath wrote:
> jgorbe wrote:
> > We're getting build errors here (and the similar call to `std::unique` on line 426) with `-Wunused-result`.
> > 
> > This looks like a bug: `std::unique` returns the new end of the range, and typically you need to call `container.erase(new_end, container.end())` after the call to `std::unique` to reduce the container size to match the new logical size. See https://en.cppreference.com/w/cpp/algorithm/unique.
> Thanks; did a quick fix forward for this. This uncovered a mistake with Compare as well; std::unique requires a == comparator, while sort and set_difference a < comparator.
Is there test coverage for these bugs/fixes?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136702/new/

https://reviews.llvm.org/D136702



More information about the llvm-commits mailing list