[llvm][FileCheck] Fix unit tests failures with EXPENSIVE_CHECKS
authorDavid Spickett <david.spickett@linaro.org>
Thu, 21 Jul 2022 15:36:52 +0000 (15:36 +0000)
committerDavid Spickett <david.spickett@linaro.org>
Mon, 25 Jul 2022 08:19:28 +0000 (08:19 +0000)
commit3a35bcef222844c20efa450cc1b47e96aa9be9b0
tree789be8e2988dc3de058b19ec2b61e0b71cd1244b
parentfb7caa3c7b53a4362139afe0158f297a891cc17b
[llvm][FileCheck] Fix unit tests failures with EXPENSIVE_CHECKS

EXPENSIVE_CHECKS enables _GLIBCXX_DEBUG, which makes std::sort
check that the compare function is implemented correctly.

To do this it calls it with the first item as both sides.
Which trips the assert here because we think they're
2 capture ranges that overlap, when it's just the same range twice.

Check up front for the two sides being the same item
(same address, not just ==).

Reviewed By: kazu

Differential Revision: https://reviews.llvm.org/D130282
llvm/lib/FileCheck/FileCheck.cpp