[cfe-commits] r94065 - /cfe/trunk/lib/Sema/SemaDecl.cpp
Mike Stump
mrs at apple.com
Wed Jan 20 19:43:13 PST 2010
Author: mrs
Date: Wed Jan 20 21:43:13 2010
New Revision: 94065
URL: http://llvm.org/viewvc/llvm-project?rev=94065&view=rev
Log:
Avoid instantiating std::sort to save on compiler size.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=94065&r1=94064&r2=94065&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Jan 20 21:43:13 2010
@@ -1411,16 +1411,10 @@
return top;
}
-namespace {
-class LineCmp {
- SourceManager &SM;
-public:
- LineCmp(SourceManager &sm) : SM(sm) {
- }
- bool operator () (SourceLocation l1, SourceLocation l2) {
- return l1 < l2;
- }
-};
+static int LineCmp(const void *p1, const void *p2) {
+ SourceLocation *Line1 = (SourceLocation *)p1;
+ SourceLocation *Line2 = (SourceLocation *)p2;
+ return !(*Line1 < *Line2);
}
/// CheckUnreachable - Check for unreachable code.
@@ -1477,7 +1471,7 @@
}
}
- std::sort(lines.begin(), lines.end(), LineCmp(Context.getSourceManager()));
+ llvm::array_pod_sort(lines.begin(), lines.end(), LineCmp);
for (llvm::SmallVector<SourceLocation, 24>::iterator I = lines.begin(),
E = lines.end();
I != E;
More information about the cfe-commits
mailing list