]> granicus.if.org Git - clang/commitdiff
Make compare function in r342648 have strict weak ordering.
authorRichard Trieu <rtrieu@google.com>
Fri, 21 Sep 2018 21:20:33 +0000 (21:20 +0000)
committerRichard Trieu <rtrieu@google.com>
Fri, 21 Sep 2018 21:20:33 +0000 (21:20 +0000)
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

lib/CodeGen/CGOpenMPRuntime.cpp

index 2f60d4d981ddc6f6adaf30755cfc464750f8b6d6..01012cb3e914149a586bd1baed239ac0d7740ab0 100644 (file)
@@ -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())