r256717 - Use std::is_sorted instead of a manual loop. NFC

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 3 11:43:20 PST 2016


Author: ctopper
Date: Sun Jan  3 13:43:20 2016
New Revision: 256717

URL: http://llvm.org/viewvc/llvm-project?rev=256717&view=rev
Log:
Use std::is_sorted instead of a manual loop. NFC

Modified:
    cfe/trunk/lib/CodeGen/CGObjCMac.cpp

Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=256717&r1=256716&r2=256717&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Sun Jan  3 13:43:20 2016
@@ -4770,11 +4770,7 @@ llvm::Constant *IvarLayoutBuilder::build
     // This isn't a stable sort, but our algorithm should handle it fine.
     llvm::array_pod_sort(IvarsInfo.begin(), IvarsInfo.end());
   } else {
-#ifndef NDEBUG
-    for (unsigned i = 1; i != IvarsInfo.size(); ++i) {
-      assert(IvarsInfo[i - 1].Offset <= IvarsInfo[i].Offset);
-    }
-#endif
+    assert(std::is_sorted(IvarsInfo.begin(), IvarsInfo.end()));
   }
   assert(IvarsInfo.back().Offset < InstanceEnd);
 




More information about the cfe-commits mailing list