File tree 2 files changed +4
-18
lines changed
2 files changed +4
-18
lines changed Original file line number Diff line number Diff line change 22
22
using namespace swift ;
23
23
24
24
void CalleeCache::sortAndUniqueCallees () {
25
- llvm::DenseMap<SILFunction *, unsigned int > FunctionEnumeration;
26
-
27
- // Enumerate the functions in the module to use as keys in sorting.
28
- unsigned int count = 0 ;
29
- for (auto &F : M)
30
- FunctionEnumeration[&F] = count++;
31
-
32
- auto Lookup = [&FunctionEnumeration](SILFunction *F) -> unsigned int {
33
- auto It = FunctionEnumeration.find (F);
34
- assert (It != FunctionEnumeration.end () &&
35
- " Function unexpectedly not found in enumeration!" );
36
-
37
- return It->second ;
38
- };
39
-
40
25
// Sort the callees for each decl and remove duplicates.
41
26
for (auto &Pair : TheCache) {
42
27
auto &Callees = *Pair.second .getPointer ();
43
28
44
29
// Sort by enumeration number so that clients get a stable order.
45
30
std::sort (Callees.begin (), Callees.end (),
46
- [&Lookup](SILFunction *Left, SILFunction *Right) {
47
- return Lookup (Left) < Lookup (Right);
31
+ [](SILFunction *Left, SILFunction *Right) {
32
+ // Check if Right's lexicographical order is greater than Left.
33
+ return 1 == Right->getName ().compare (Left->getName ());
48
34
});
49
35
50
36
// Remove duplicates.
Original file line number Diff line number Diff line change @@ -14,8 +14,8 @@ import Builtin
14
14
// CHECK-NEXT: public_bottom
15
15
// CHECK-NEXT: public_middle
16
16
// CHECK-NEXT: public_top
17
- // CHECK-NEXT: private_derived_foo
18
17
// CHECK-NEXT: private_base_foo
18
+ // CHECK-NEXT: private_derived_foo
19
19
// CHECK-NEXT: call_private
20
20
// CHECK-NEXT: internal_base_foo
21
21
// CHECK-NEXT: internal_derived_foo
You can’t perform that action at this time.
0 commit comments