From: Richard Trieu Date: Fri, 21 Sep 2018 21:20:33 +0000 (+0000) Subject: Make compare function in r342648 have strict weak ordering. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5061b662eb82f08eafb045229e9f810aff962449;p=clang Make compare function in r342648 have strict weak ordering. Comparison functions used in sorting algorithms need to have strict weak ordering. Remove the assert and allow comparisons on all lists. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342774 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGOpenMPRuntime.cpp b/lib/CodeGen/CGOpenMPRuntime.cpp index 2f60d4d981..01012cb3e9 100644 --- a/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/lib/CodeGen/CGOpenMPRuntime.cpp @@ -7607,8 +7607,15 @@ public: SI->getAssociatedDeclaration()) break; } - assert(CI != CE && SI != SE && - "Unexpected end of the map components."); + + // Lists contain the same elements. + if (CI == CE && SI == SE) + return false; + + // List with less elements is less than list with more elements. + if (CI == CE || SI == SE) + return CI == CE; + const auto *FD1 = cast(CI->getAssociatedDeclaration()); const auto *FD2 = cast(SI->getAssociatedDeclaration()); if (FD1->getParent() == FD2->getParent())