Author: rtrieu Date: Fri Sep 21 14:20:33 2018 New Revision: 342774 URL: http://llvm.org/viewvc/llvm-project?rev=342774&view=rev Log: 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. Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=342774&r1=342773&r2=342774&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original) +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Fri Sep 21 14:20:33 2018 @@ -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<FieldDecl>(CI->getAssociatedDeclaration()); const auto *FD2 = cast<FieldDecl>(SI->getAssociatedDeclaration()); if (FD1->getParent() == FD2->getParent()) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits