summaryrefslogtreecommitdiffstats
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
commit87f2f9b4656fb11104bbb2d80fcfaac998865f50 (patch)
treee7119a0ad25541f5c4298410ab51bef2228ff161
parent7df27e7038bf3a8a48ba107f0f5b9d5f67710bb1 (diff)
downloadbcm5719-llvm-87f2f9b4656fb11104bbb2d80fcfaac998865f50.tar.gz
bcm5719-llvm-87f2f9b4656fb11104bbb2d80fcfaac998865f50.zip
Avoid instantiating std::sort to save on compiler size.
llvm-svn: 94065
-rw-r--r--clang/lib/Sema/SemaDecl.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 1f7ef3d23e6..17a2c8089f6 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud