[cfe-commits] r69851 - /cfe/tags/Apple/clang/clang/tools/clang/lib/CodeGen/CGObjCMac.cpp
Mike Stump
mrs at apple.com
Wed Apr 22 19:04:05 PDT 2009
Author: mrs
Date: Wed Apr 22 21:04:04 2009
New Revision: 69851
URL: http://llvm.org/viewvc/llvm-project?rev=69851&view=rev
Log:
Backport r69850.
Modified:
cfe/tags/Apple/clang/clang/tools/clang/lib/CodeGen/CGObjCMac.cpp
Modified: cfe/tags/Apple/clang/clang/tools/clang/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/tags/Apple/clang/clang/tools/clang/lib/CodeGen/CGObjCMac.cpp?rev=69851&r1=69850&r2=69851&view=diff
==============================================================================
--- cfe/tags/Apple/clang/clang/tools/clang/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/tags/Apple/clang/clang/tools/clang/lib/CodeGen/CGObjCMac.cpp Wed Apr 22 21:04:04 2009
@@ -707,6 +707,11 @@
unsigned int ivar_bytepos;
unsigned int ivar_size;
GC_IVAR() : ivar_bytepos(0), ivar_size(0) {}
+
+ // Allow sorting based on byte pos.
+ bool operator<(const GC_IVAR &b) const {
+ return ivar_bytepos < b.ivar_bytepos;
+ }
};
class SKIP_SCAN {
@@ -3103,19 +3108,6 @@
}
}
-static int
-IvarBytePosCompare(const void *a, const void *b)
-{
- unsigned int sa = ((CGObjCCommonMac::GC_IVAR *)a)->ivar_bytepos;
- unsigned int sb = ((CGObjCCommonMac::GC_IVAR *)b)->ivar_bytepos;
-
- if (sa < sb)
- return -1;
- if (sa > sb)
- return 1;
- return 0;
-}
-
/// BuildIvarLayout - Builds ivar layout bitmap for the class
/// implementation for the __strong or __weak case.
/// The layout map displays which words in ivar list must be skipped
@@ -3163,9 +3155,9 @@
// Sort on byte position in case we encounterred a union nested in
// the ivar list.
if (hasUnion && !IvarsInfo.empty())
- qsort(&IvarsInfo[0], Index+1, sizeof(GC_IVAR), IvarBytePosCompare);
+ std::sort(IvarsInfo.begin(), IvarsInfo.end());
if (hasUnion && !SkipIvars.empty())
- qsort(&SkipIvars[0], Index+1, sizeof(GC_IVAR), IvarBytePosCompare);
+ std::sort(SkipIvars.begin(), SkipIvars.end());
// Build the string of skip/scan nibbles
SkipScan = -1;
More information about the cfe-commits
mailing list