[all-commits] [llvm/llvm-project] 26f5d1: [APINotes] Avoid assertion failure with expensive ...

Björn Pettersson via All-commits all-commits at lists.llvm.org
Wed Dec 18 14:37:06 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 26f5d1ee9c37e2a6d50898a5bf2d3b9171060ba0
      https://github.com/llvm/llvm-project/commit/26f5d1ee9c37e2a6d50898a5bf2d3b9171060ba0
  Author: Björn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2024-12-18 (Wed, 18 Dec 2024)

  Changed paths:
    M clang/lib/APINotes/APINotesReader.cpp

  Log Message:
  -----------
  [APINotes] Avoid assertion failure with expensive checks (#120487)

Found assertion failures when using EXPENSIVE_CHECKS and running lit
tests for APINotes:
Assertion `left.first != right.first && "two entries for the same
version"' failed.

It seems like std::is_sorted is verifying that the comparison function
is reflective (comp(a,a)=false) when using expensive checks. So we would
get callbacks to the lambda used for comparison, even for vectors with a
single element in APINotesReader::VersionedInfo<T>::VersionedInfo, with
"left" and "right" being the same object. Therefore the assert checking
that we never found equal values would fail.

Fix makes sure that we skip the check for equal values when "left" and
"right" is the same object.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list