File tree 1 file changed +2
-17
lines changed
1 file changed +2
-17
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
+ return Left-> getName (). compare (Right-> getName () );
48
33
});
49
34
50
35
// Remove duplicates.
You can’t perform that action at this time.
0 commit comments