Skip to content

Commit

Permalink
Fix a bug in the lexicographically order of functions in the callee set.
Browse files Browse the repository at this point in the history
This fixes a bug that was introduced in 95b2fa869bf3208c8e52558a008b1c3d02bee706.
  • Loading branch information
nadavrot committed Nov 23, 2015
1 parent d78c4db commit 693f6af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/SILAnalysis/BasicCalleeAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ void CalleeCache::sortAndUniqueCallees() {
// Sort by enumeration number so that clients get a stable order.
std::sort(Callees.begin(), Callees.end(),
[](SILFunction *Left, SILFunction *Right) {
return Left->getName().compare(Right->getName());
// Check if Right's lexicographical order is greater than Left.
return 1 == Right->getName().compare(Left->getName());
});

// Remove duplicates.
Expand Down
2 changes: 1 addition & 1 deletion test/SILAnalysis/function-order.sil
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import Builtin
// CHECK-NEXT: public_bottom
// CHECK-NEXT: public_middle
// CHECK-NEXT: public_top
// CHECK-NEXT: private_derived_foo
// CHECK-NEXT: private_base_foo
// CHECK-NEXT: private_derived_foo
// CHECK-NEXT: call_private
// CHECK-NEXT: internal_base_foo
// CHECK-NEXT: internal_derived_foo
Expand Down

0 comments on commit 693f6af

Please sign in to comment.