16#include "llvm/ADT/StringRef.h"
17#include "llvm/Support/ErrorHandling.h"
24 : Name(R->Name), USR(R->USR),
Record(R) {}
28#define RECORD_CONTEXT(CLASS, KIND) \
30 return static_cast<CLASS *>(const_cast<RecordContext *>(Ctx));
42 switch (
Record->getKind()) {
43#define RECORD_CONTEXT(CLASS, KIND) \
45 return static_cast<CLASS *>(const_cast<APIRecord *>(Record));
54bool RecordContext::IsWellFormed()
const {
56 return (First ==
nullptr) == (Last ==
nullptr);
60 assert(IsWellFormed());
62 if (
Other.First ==
nullptr &&
Other.Last ==
nullptr)
67 Last->NextInContext =
Other.First;
73 for (
auto *StolenRecord =
Other.First; StolenRecord !=
nullptr;
74 StolenRecord = StolenRecord->getNextInContext())
78 Other.First =
nullptr;
83 assert(IsWellFormed());
90 Last->NextInContext =
Record;
96 for (
APIRecord *Curr = First; Curr !=
Record; Curr = Curr->NextInContext)
100 Prev->NextInContext =
Record->NextInContext;
102 First =
Record->NextInContext;
107 Record->NextInContext =
nullptr;
114 auto FindIt = USRBasedLookupTable.find(USR);
115 if (FindIt != USRBasedLookupTable.end())
116 return FindIt->getSecond().get();
126 if (Allocator.identifyObject(String.data()))
129 void *Ptr = Allocator.Allocate(String.size(), 1);
130 memcpy(Ptr, String.data(), String.size());
131 return StringRef(
reinterpret_cast<const char *
>(Ptr), String.size());
140 auto Result = USRBasedLookupTable.find(USR);
141 if (
Result != USRBasedLookupTable.end()) {
143 auto &ParentReference =
Record->Parent;
144 auto *ParentRecord =
const_cast<APIRecord *
>(ParentReference.Record);
148 if (
auto *ParentCtx = llvm::cast_if_present<RecordContext>(ParentRecord)) {
149 ParentCtx->removeFromRecordChain(
Record);
150 if (
auto *RecordAsCtx = llvm::dyn_cast<RecordContext>(
Record))
151 ParentCtx->stealRecordChain(*RecordAsCtx);
153 TopLevelRecords.erase(
Record);
154 if (
auto *RecordAsCtx = llvm::dyn_cast<RecordContext>(
Record)) {
155 for (
const auto *Child = RecordAsCtx->First; Child !=
nullptr;
156 Child = Child->getNextInContext())
157 TopLevelRecords.insert(Child);
160 USRBasedLookupTable.erase(
Result);
170ObjCContainerRecord::~ObjCContainerRecord() {}
175void GlobalFunctionRecord::anchor() {}
176void GlobalVariableRecord::anchor() {}
177void EnumConstantRecord::anchor() {}
178void EnumRecord::anchor() {}
179void StructFieldRecord::anchor() {}
180void StructRecord::anchor() {}
181void UnionFieldRecord::anchor() {}
182void UnionRecord::anchor() {}
183void CXXFieldRecord::anchor() {}
184void CXXClassRecord::anchor() {}
185void CXXConstructorRecord::anchor() {}
186void CXXDestructorRecord::anchor() {}
187void CXXInstanceMethodRecord::anchor() {}
188void CXXStaticMethodRecord::anchor() {}
189void ObjCInstancePropertyRecord::anchor() {}
190void ObjCClassPropertyRecord::anchor() {}
191void ObjCInstanceVariableRecord::anchor() {}
192void ObjCInstanceMethodRecord::anchor() {}
193void ObjCClassMethodRecord::anchor() {}
194void ObjCCategoryRecord::anchor() {}
195void ObjCInterfaceRecord::anchor() {}
196void ObjCProtocolRecord::anchor() {}
197void MacroDefinitionRecord::anchor() {}
198void TypedefRecord::anchor() {}
This file defines the APIRecord-based structs and the APISet class.
llvm::MachO::Record Record
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
@ Result
The result type of a method or function.
@ Other
Other implicit parameter.
Diagnostic wrappers for TextAPI types for error reporting.