comparison lib/Object/SymbolSize.cpp @ 120:1172e4bd9c6f

update 4.0.0
author mir3636
date Fri, 25 Nov 2016 19:14:25 +0900
parents afa8332a0e37
children c2174574ed3a
comparison
equal deleted inserted replaced
101:34baf5011add 120:1172e4bd9c6f
14 #include "llvm/Object/MachO.h" 14 #include "llvm/Object/MachO.h"
15 15
16 using namespace llvm; 16 using namespace llvm;
17 using namespace object; 17 using namespace object;
18 18
19 namespace { 19 // Orders increasingly by (SectionID, Address).
20 struct SymEntry { 20 int llvm::object::compareAddress(const SymEntry *A, const SymEntry *B) {
21 symbol_iterator I;
22 uint64_t Address;
23 unsigned Number;
24 unsigned SectionID;
25 };
26 }
27
28 static int compareAddress(const SymEntry *A, const SymEntry *B) {
29 if (A->SectionID != B->SectionID) 21 if (A->SectionID != B->SectionID)
30 return A->SectionID - B->SectionID; 22 return A->SectionID < B->SectionID ? -1 : 1;
31 return A->Address - B->Address; 23 if (A->Address != B->Address)
24 return A->Address < B->Address ? -1 : 1;
25 return 0;
32 } 26 }
33 27
34 static unsigned getSectionID(const ObjectFile &O, SectionRef Sec) { 28 static unsigned getSectionID(const ObjectFile &O, SectionRef Sec) {
35 if (auto *M = dyn_cast<MachOObjectFile>(&O)) 29 if (auto *M = dyn_cast<MachOObjectFile>(&O))
36 return M->getSectionID(Sec); 30 return M->getSectionID(Sec);