Skip to content

Commit 693f6af

Browse files
committed
Fix a bug in the lexicographically order of functions in the callee set.
This fixes a bug that was introduced in 95b2fa869bf3208c8e52558a008b1c3d02bee706.
1 parent d78c4db commit 693f6af

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/SILAnalysis/BasicCalleeAnalysis.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ void CalleeCache::sortAndUniqueCallees() {
2929
// Sort by enumeration number so that clients get a stable order.
3030
std::sort(Callees.begin(), Callees.end(),
3131
[](SILFunction *Left, SILFunction *Right) {
32-
return Left->getName().compare(Right->getName());
32+
// Check if Right's lexicographical order is greater than Left.
33+
return 1 == Right->getName().compare(Left->getName());
3334
});
3435

3536
// Remove duplicates.

test/SILAnalysis/function-order.sil

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import Builtin
1414
// CHECK-NEXT: public_bottom
1515
// CHECK-NEXT: public_middle
1616
// CHECK-NEXT: public_top
17-
// CHECK-NEXT: private_derived_foo
1817
// CHECK-NEXT: private_base_foo
18+
// CHECK-NEXT: private_derived_foo
1919
// CHECK-NEXT: call_private
2020
// CHECK-NEXT: internal_base_foo
2121
// CHECK-NEXT: internal_derived_foo

0 commit comments

Comments
 (0)