LLVM: lib/Object/TapiFile.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
21
22using namespace llvm;
23using namespace MachO;
24using namespace object;
25
30 else
32
35
36 return Flags;
37}
38
43 else if (Sym->isText())
45
47}
48
52 FileKind(Interface.getFileType()) {
53 for (const auto *Symbol : Interface.symbols()) {
54 if (!Symbol->getArchitectures().has(Arch))
55 continue;
56
57 switch (Symbol->getKind()) {
58 case EncodeKind::GlobalSymbol:
59 Symbols.emplace_back(StringRef(), Symbol->getName(), getFlags(Symbol),
60 ::getType(Symbol));
61 break;
62 case EncodeKind::ObjectiveCClass:
63 if (Interface.getPlatforms().count(PLATFORM_MACOS) && Arch == AK_i386) {
64 Symbols.emplace_back(ObjC1ClassNamePrefix, Symbol->getName(),
65 getFlags(Symbol), ::getType(Symbol));
66 } else {
67 Symbols.emplace_back(ObjC2ClassNamePrefix, Symbol->getName(),
68 getFlags(Symbol), ::getType(Symbol));
69 Symbols.emplace_back(ObjC2MetaClassNamePrefix, Symbol->getName(),
70 getFlags(Symbol), ::getType(Symbol));
71 }
72 break;
73 case EncodeKind::ObjectiveCClassEHType:
74 Symbols.emplace_back(ObjC2EHTypePrefix, Symbol->getName(),
75 getFlags(Symbol), ::getType(Symbol));
76 break;
77 case EncodeKind::ObjectiveCInstanceVariable:
78 Symbols.emplace_back(ObjC2IVarPrefix, Symbol->getName(), getFlags(Symbol),
79 ::getType(Symbol));
80 break;
81 }
82 }
83}
84
86
88
90 assert(DRI.d.a < Symbols.size() && "Attempt to access symbol out of bounds");
91 const Symbol &Sym = Symbols[DRI.d.a];
92 OS << Sym.Prefix << Sym.Name;
94}
95
97 assert(DRI.d.a < Symbols.size() && "Attempt to access symbol out of bounds");
98 return Symbols[DRI.d.a].Type;
99}
100
102 assert(DRI.d.a < Symbols.size() && "Attempt to access symbol out of bounds");
103 return Symbols[DRI.d.a].Flags;
104}
105
111
116}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static uint32_t getFlags(const Symbol *Sym)
Definition TapiFile.cpp:26
static SymbolRef::Type getType(const Symbol *Sym)
Definition TapiFile.cpp:39
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Defines the interface file.
bool isWeakDefined() const
bool isWeakReferenced() const
The instances of the Type class are immutable: once they are created, they are never changed.
This is a value type class that represents a single symbol in the list of symbols in the object file.
SymbolicFile(unsigned int Type, MemoryBufferRef Source)
Expected< SymbolRef::Type > getSymbolType(DataRefImpl DRI) const
Definition TapiFile.cpp:96
void moveSymbolNext(DataRefImpl &DRI) const override
Definition TapiFile.cpp:87
Expected< uint32_t > getSymbolFlags(DataRefImpl DRI) const override
Definition TapiFile.cpp:101
basic_symbol_iterator symbol_end() const override
Definition TapiFile.cpp:112
TapiFile(MemoryBufferRef Source, const MachO::InterfaceFile &Interface, MachO::Architecture Arch)
Definition TapiFile.cpp:49
Error printSymbolName(raw_ostream &OS, DataRefImpl DRI) const override
Definition TapiFile.cpp:89
basic_symbol_iterator symbol_begin() const override
Definition TapiFile.cpp:106
This class implements an extremely fast bulk output stream that can only output to a stream.
Architecture
Defines the architecture slices that are supported by Text-based Stub files.
content_iterator< BasicSymbolRef > basic_symbol_iterator
This is an optimization pass for GlobalISel generic memory operations.
struct llvm::object::DataRefImpl::@005117267142344013370254144343227032034000327225 d