42 auto [Super, IVar] =
Name.split(
'.');
46 if (Container ==
nullptr)
61 if (Container ==
nullptr)
66template <
typename R,
typename C = RecordMap<R>,
typename K = StringRef>
68 const auto *
Record = Container.find(Key);
69 if (
Record == Container.end())
71 return Record->second.get();
76 auto *
Record = findRecord<GlobalRecord>(
Name, Globals);
101 "expected single ObjCIFSymbolKind enum value");
103 return Linkages.Class;
106 return Linkages.MetaClass;
109 return Linkages.EHType;
117 Linkages.Class = std::max(Link, Linkages.Class);
119 Linkages.MetaClass = std::max(Link, Linkages.MetaClass);
121 Linkages.EHType = std::max(Link, Linkages.EHType);
128 std::max(Linkages.Class, std::max(Linkages.MetaClass, Linkages.EHType));
132 return findRecord<ObjCInterfaceRecord>(
Name, Classes);
137 return findRecord<ObjCCategoryRecord>(std::make_pair(ClassToExtend, Category),
142 return findRecord<ObjCIVarRecord>(IVar, IVars);
155 return Container->findObjCIVar(IVar);
160 for (
const auto &[
_, Container] :
Records) {
161 if (
auto *IVarR = Container->findObjCIVar(
Name))
167 if (
auto *IVarRecord = getIVar(Classes))
170 return getIVar(Categories);
182 auto Result = Globals.insert({
Name,
nullptr});
184 Result.first->second =
185 std::make_unique<GlobalRecord>(
Name, Linkage, Flags, GV, Inlined);
187 updateLinkage(Result.first->second.get(), Linkage);
188 updateFlags(Result.first->second.get(), Flags);
190 return Result.first->second.get();
197 auto Result = Classes.insert({
Name,
nullptr});
199 Result.first->second =
200 std::make_unique<ObjCInterfaceRecord>(
Name, Linkage, SymType);
202 Result.first->second->updateLinkageForSymbols(SymType, Linkage);
203 return Result.first->second.get();
221 auto Result = Categories.insert({
Name,
Record});
222 return Result.second;
232 Categories.insert({std::make_pair(ClassToExtend, Category),
nullptr});
234 Result.first->second =
235 std::make_unique<ObjCCategoryRecord>(ClassToExtend, Category);
239 ObjCClass->addObjCCategory(Result.first->second.get());
241 return Result.first->second.get();
245 std::vector<ObjCIVarRecord *>
Records;
247 for (
const auto &
Record : IVars)
252std::vector<ObjCCategoryRecord *>
254 std::vector<ObjCCategoryRecord *>
Records;
256 for (
const auto &
Record : Categories)
263 auto Result = IVars.insert({IVar,
nullptr});
265 Result.first->second = std::make_unique<ObjCIVarRecord>(IVar,
Linkage);
266 return Result.first->second.get();
274 updateLinkage(
Record, Linkage);
292 BA = std::make_unique<BinaryAttrs>();
297 for (
auto &
G : Globals)
298 V.visitGlobal(*
G.second);
299 for (
auto &
C : Classes)
300 V.visitObjCInterface(*
C.second);
301 for (
auto &Cat : Categories)
302 V.visitObjCCategory(*Cat.second);
305static std::unique_ptr<InterfaceFile>
308 auto Symbols = std::make_unique<SymbolSet>();
309 for (
auto &S : Slices) {
312 auto &BA = S->getBinaryAttrs();
313 if (BA.InstallName != InstallName)
317 !BA.TwoLevelNamespace);
321 auto File = std::make_unique<InterfaceFile>(std::move(Symbols));
322 File->setInstallName(InstallName);
324 for (
auto &S : Slices) {
327 auto &BA = S->getBinaryAttrs();
328 if (BA.InstallName != InstallName)
330 const Target &Targ = S->getTarget();
331 File->addTarget(Targ);
332 File->setFromBinaryAttrs(BA, Targ);
338std::unique_ptr<InterfaceFile>
340 std::unique_ptr<InterfaceFile> File;
345 for (
auto &S : Slices) {
346 auto Name = S->getBinaryAttrs().InstallName;
static std::unique_ptr< InterfaceFile > createInterfaceFile(const Records &Slices, StringRef InstallName)
R * findRecord(K Key, const C &Container)
Implements the TAPI Record Collection Type.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements a set that has insertion order iteration characteristics.
Implements the TAPI Record Types.
std::optional< int64_t > identifyObject(const void *Ptr)
LLVM_ATTRIBUTE_RETURNS_NONNULL void * Allocate(size_t Size, Align Alignment)
Allocate space at the specified alignment.
ObjCIVarRecord * addObjCIVar(StringRef IVar, RecordLinkage Linkage)
ObjCIVarRecord * findObjCIVar(StringRef IVar) const
std::vector< ObjCIVarRecord * > getObjCIVars() const
RecordLinkage getLinkageForSymbol(ObjCIFSymbolKind CurrType) const
std::vector< ObjCCategoryRecord * > getObjCCategories() const
bool addObjCCategory(ObjCCategoryRecord *Record)
void updateLinkageForSymbols(ObjCIFSymbolKind SymType, RecordLinkage Link)
Base class for any usage of traversing over collected Records.
StringRef copyString(StringRef String)
Store any strings owned by RecordSlice into allocator and return back reference to that.
ObjCIVarRecord * findObjCIVar(bool IsScopedName, StringRef Name) const
Find ObjC instance variable.
ObjCCategoryRecord * addObjCCategory(StringRef ClassToExtend, StringRef Category)
Add ObjC Category record.
ObjCInterfaceRecord * addObjCInterface(StringRef Name, RecordLinkage Linkage, ObjCIFSymbolKind SymType)
Add ObjC Class record.
ObjCContainerRecord * findContainer(bool IsIVar, StringRef Name) const
Find ObjC Container.
ObjCIVarRecord * addObjCIVar(ObjCContainerRecord *Container, StringRef Name, RecordLinkage Linkage)
Add ObjC IVar record.
GlobalRecord * addGlobal(StringRef Name, RecordLinkage Linkage, GlobalRecord::Kind GV, SymbolFlags Flags=SymbolFlags::None, bool Inlined=false)
Add non-ObjC global record.
GlobalRecord * findGlobal(StringRef Name, GlobalRecord::Kind GV=GlobalRecord::Kind::Unknown) const
Find non-objc global.
ObjCCategoryRecord * findObjCCategory(StringRef ClassToExtend, StringRef Category) const
Find ObjC Category.
BinaryAttrs & getBinaryAttrs()
Return reference to BinaryAttrs.
ObjCInterfaceRecord * findObjCInterface(StringRef Name) const
Find ObjC Class.
Record * addRecord(StringRef Name, SymbolFlags Flags, GlobalRecord::Kind GV=GlobalRecord::Kind::Unknown, RecordLinkage Linkage=RecordLinkage::Unknown)
Add unspecified record to slice.
void visit(RecordVisitor &V) const
bool hasBinaryAttrs() const
Specialized RecordVisitor for collecting exported symbols and undefined symbols if RecordSlice being ...
A vector that has set insertion semantics.
iterator begin()
Get an iterator to the beginning of the SetVector.
bool insert(const value_type &X)
Insert a new element into the SetVector.
void reserve(size_type N)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
std::unique_ptr< InterfaceFile > convertToInterfaceFile(const Records &Slices)
ObjCIFSymbolKind
ObjC Interface symbol mappings.
@ EHType
Is OBJC_EHTYPE* symbol.
@ Class
Is OBJC_CLASS* symbol.
@ MetaClass
Is OBJC_METACLASS* symbol.
@ ObjectiveCInstanceVariable
SimpleSymbol parseSymbol(StringRef SymName)
Get symbol classification by parsing the name of a symbol.
llvm::SmallVector< std::shared_ptr< RecordsSlice >, 4 > Records
@ WeakDefined
Weak defined symbol.
This is an optimization pass for GlobalISel generic memory operations.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.