aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorMike Stump <mrs@apple.com>2010-01-21 03:43:13 +0000
committerMike Stump <mrs@apple.com>2010-01-21 03:43:13 +0000
commitd40e94d050670208ba3d9e7ffa59b5d7cb58ef0a (patch)
treeb5126ad63a86242cac9d96dce4fc96df0c9330fe /lib/Sema/SemaDecl.cpp
parent44fa21054574cf9e5f3a08c0b6a44f82aa5b44e4 (diff)
Avoid instantiating std::sort to save on compiler size.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94065 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 1f7ef3d23e..17a2c8089f 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1411,16 +1411,10 @@ static SourceLocation MarkLiveTop(CFGBlock *e, llvm::BitVector &live,
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 @@ void Sema::CheckUnreachable(AnalysisContext &AC) {
}
}
- 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;