13#include "llvm/ADT/DenseMap.h"
14#include "llvm/ADT/StringMap.h"
15#include "llvm/Bitstream/BitstreamWriter.h"
16#include "llvm/Support/DJB.h"
17#include "llvm/Support/OnDiskHashTable.h"
18#include "llvm/Support/VersionTuple.h"
26 using VersionedSmallVector =
29 std::string ModuleName;
36 llvm::StringMap<IdentifierID> IdentifierIDs;
45 std::pair<unsigned, VersionedSmallVector<ContextInfo>>>
51 llvm::DenseMap<uint32_t, uint32_t> ParentContexts;
54 llvm::DenseMap<unsigned, uint8_t> ContextKinds;
57 llvm::DenseMap<unsigned, unsigned> ContextNames;
64 std::tuple<unsigned, unsigned, char>,
79 llvm::DenseMap<std::tuple<unsigned, unsigned, char>,
91 llvm::DenseMap<StoredObjCSelector, SelectorID> SelectorIDs;
132 if (Identifier.empty())
136 return IdentifierIDs.try_emplace(Identifier, IdentifierIDs.size() + 1)
141 std::optional<FunctionTableKey> Key =
143 [
this](StringRef S) -> std::optional<IdentifierID> {
146 assert(Key &&
"Writer identifier lookup should not fail");
150 FunctionTableKey getFunctionKey(
uint32_t ParentContextID, StringRef Name,
152 std::optional<FunctionTableKey> Key =
154 [
this](StringRef S) -> std::optional<IdentifierID> {
157 assert(Key &&
"Writer identifier lookup should not fail");
161 FunctionTableKey getFunctionKey(std::optional<Context> ParentContext,
164 ParentContext ? ParentContext->id.Value :
static_cast<uint32_t>(-1);
165 return getFunctionKey(ParentContextID, Name);
168 FunctionTableKey getFunctionKey(std::optional<Context> ParentContext,
170 ArrayRef<StringRef> Parameters) {
172 ParentContext ? ParentContext->id.Value :
static_cast<uint32_t>(-1);
173 return getFunctionKey(ParentContextID, Name, Parameters);
177 SelectorID getSelector(ObjCSelectorRef SelectorRef) {
179 StoredObjCSelector Selector;
180 Selector.NumArgs = SelectorRef.NumArgs;
181 Selector.Identifiers.reserve(SelectorRef.Identifiers.size());
182 for (
auto piece : SelectorRef.Identifiers)
186 return SelectorIDs.try_emplace(Selector, SelectorIDs.size()).first->second;
190 void writeBlockInfoBlock(llvm::BitstreamWriter &Stream);
191 void writeControlBlock(llvm::BitstreamWriter &Stream);
192 void writeIdentifierBlock(llvm::BitstreamWriter &Stream);
193 void writeContextBlock(llvm::BitstreamWriter &Stream);
194 void writeObjCPropertyBlock(llvm::BitstreamWriter &Stream);
195 void writeObjCMethodBlock(llvm::BitstreamWriter &Stream);
196 void writeCXXMethodBlock(llvm::BitstreamWriter &Stream);
197 void writeFieldBlock(llvm::BitstreamWriter &Stream);
198 void writeObjCSelectorBlock(llvm::BitstreamWriter &Stream);
199 void writeGlobalVariableBlock(llvm::BitstreamWriter &Stream);
200 void writeGlobalFunctionBlock(llvm::BitstreamWriter &Stream);
201 void writeEnumConstantBlock(llvm::BitstreamWriter &Stream);
202 void writeTagBlock(llvm::BitstreamWriter &Stream);
203 void writeTypedefBlock(llvm::BitstreamWriter &Stream);
207 : ModuleName(
std::string(ModuleName)), SourceFile(SF) {}
216 llvm::BitstreamWriter Stream(Buffer);
220 Stream.Emit(Byte, 8);
223 writeBlockInfoBlock(Stream);
224 writeControlBlock(Stream);
225 writeIdentifierBlock(Stream);
226 writeContextBlock(Stream);
227 writeObjCPropertyBlock(Stream);
228 writeObjCMethodBlock(Stream);
229 writeCXXMethodBlock(Stream);
230 writeFieldBlock(Stream);
231 writeObjCSelectorBlock(Stream);
232 writeGlobalVariableBlock(Stream);
233 writeGlobalFunctionBlock(Stream);
234 writeEnumConstantBlock(Stream);
235 writeTagBlock(Stream);
236 writeTypedefBlock(Stream);
239 OS.write(Buffer.data(), Buffer.size());
245void emitBlockID(llvm::BitstreamWriter &Stream,
unsigned ID,
246 llvm::StringRef Name) {
247 Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETBID,
254 llvm::bitc::BLOCKINFO_CODE_BLOCKNAME,
256 const_cast<unsigned char *
>(
257 reinterpret_cast<const unsigned char *
>(Name.data())),
262void emitRecordID(llvm::BitstreamWriter &Stream,
unsigned ID,
263 llvm::StringRef Name) {
264 assert(ID < 256 &&
"can't fit record ID in next to name");
267 Buffer.resize(Name.size() + 1);
269 memcpy(Buffer.data() + 1, Name.data(), Name.size());
271 Stream.EmitRecord(llvm::bitc::BLOCKINFO_CODE_SETRECORDNAME, Buffer);
275void APINotesWriter::Implementation::writeBlockInfoBlock(
276 llvm::BitstreamWriter &Stream) {
277 llvm::BCBlockRAII Scope(Stream, llvm::bitc::BLOCKINFO_BLOCK_ID, 2);
279#define BLOCK(Block) emitBlockID(Stream, Block##_ID, #Block)
280#define BLOCK_RECORD(NameSpace, Block) \
281 emitRecordID(Stream, NameSpace::Block, #Block)
282 BLOCK(CONTROL_BLOCK);
286 BLOCK(IDENTIFIER_BLOCK);
289 BLOCK(OBJC_CONTEXT_BLOCK);
292 BLOCK(OBJC_PROPERTY_BLOCK);
295 BLOCK(OBJC_METHOD_BLOCK);
298 BLOCK(OBJC_SELECTOR_BLOCK);
301 BLOCK(GLOBAL_VARIABLE_BLOCK);
302 BLOCK_RECORD(global_variable_block, GLOBAL_VARIABLE_DATA);
304 BLOCK(GLOBAL_FUNCTION_BLOCK);
305 BLOCK_RECORD(global_function_block, GLOBAL_FUNCTION_DATA);
310void APINotesWriter::Implementation::writeControlBlock(
311 llvm::BitstreamWriter &Stream) {
318 ModuleName.emit(Scratch, this->ModuleName);
322 SourceFile.emit(Scratch, this->SourceFile->
getSize(),
323 this->SourceFile->getModificationTime());
329class IdentifierTableInfo {
331 using key_type = StringRef;
332 using key_type_ref = key_type;
334 using data_type_ref =
const data_type &;
336 using offset_type = unsigned;
338 hash_value_type
ComputeHash(key_type_ref Key) {
return llvm::djbHash(Key); }
340 std::pair<unsigned, unsigned>
341 EmitKeyDataLength(raw_ostream &OS, key_type_ref Key, data_type_ref) {
345 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
348 return {KeyLength, DataLength};
351 void EmitKey(raw_ostream &OS, key_type_ref Key,
unsigned) {
OS << Key; }
353 void EmitData(raw_ostream &OS, key_type_ref, data_type_ref Data,
unsigned) {
354 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
360void APINotesWriter::Implementation::writeIdentifierBlock(
361 llvm::BitstreamWriter &Stream) {
364 if (IdentifierIDs.empty())
367 llvm::SmallString<4096> HashTableBlob;
370 llvm::OnDiskChainedHashTableGenerator<IdentifierTableInfo>
Generator;
371 for (
auto &II : IdentifierIDs)
374 llvm::raw_svector_ostream BlobStream(HashTableBlob);
376 llvm::support::endian::write<uint32_t>(BlobStream, 0,
377 llvm::endianness::little);
382 IdentifierData.emit(Scratch, Offset, HashTableBlob);
387class ContextIDTableInfo {
389 using key_type = ContextTableKey;
390 using key_type_ref = key_type;
391 using data_type = unsigned;
392 using data_type_ref =
const data_type &;
393 using hash_value_type =
size_t;
394 using offset_type = unsigned;
397 return static_cast<size_t>(Key.hashValue());
400 std::pair<unsigned, unsigned> EmitKeyDataLength(raw_ostream &OS, key_type_ref,
405 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
408 return {KeyLength, DataLength};
411 void EmitKey(raw_ostream &OS, key_type_ref Key,
unsigned) {
412 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
413 writer.write<
uint32_t>(Key.parentContextID);
414 writer.write<
uint8_t>(Key.contextKind);
415 writer.write<
uint32_t>(Key.contextID);
418 void EmitData(raw_ostream &OS, key_type_ref, data_type_ref Data,
unsigned) {
419 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
426template <
typename T>
struct MakeDependent {
typedef T Type; };
430unsigned getVersionTupleSize(
const VersionTuple &VT) {
434 if (VT.getSubminor())
443unsigned getVersionedInfoSize(
444 const llvm::SmallVectorImpl<std::pair<llvm::VersionTuple, T>> &VI,
445 llvm::function_ref<
unsigned(
const typename MakeDependent<T>::Type &)>
448 for (
const auto &E : VI) {
449 result += getVersionTupleSize(E.first);
450 result += getInfoSize(E.second);
456void emitVersionTuple(raw_ostream &OS,
const VersionTuple &VT) {
457 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
463 else if (VT.getSubminor())
465 else if (VT.getMinor())
469 writer.write<
uint8_t>(descriptor);
472 writer.write<
uint32_t>(VT.getMajor());
473 if (
auto minor = VT.getMinor())
475 if (
auto subminor = VT.getSubminor())
477 if (
auto build = VT.getBuild())
483void emitVersionedInfo(
484 raw_ostream &OS, llvm::SmallVectorImpl<std::pair<VersionTuple, T>> &VI,
485 llvm::function_ref<
void(raw_ostream &,
486 const typename MakeDependent<T>::Type &)>
488 std::sort(VI.begin(), VI.end(),
489 [](
const std::pair<VersionTuple, T> &LHS,
490 const std::pair<VersionTuple, T> &RHS) ->
bool {
491 assert((&LHS == &RHS || LHS.first != RHS.first) &&
492 "two entries for the same version");
493 return LHS.first < RHS.first;
496 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
498 for (
const auto &E : VI) {
499 emitVersionTuple(OS, E.first);
500 emitInfo(OS, E.second);
504static unsigned getFunctionTableKeyLength(
const FunctionTableKey &Key) {
506 (Key.parameterTypeIDs ? Key.parameterTypeIDs->size() *
sizeof(
uint32_t)
510static void emitFunctionTableKey(raw_ostream &OS,
const FunctionTableKey &Key) {
511 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
512 writer.write<
uint32_t>(Key.parentContextID);
516 writer.write<
uint16_t>(Key.parameterTypeIDs ? Key.parameterTypeIDs->size()
518 if (Key.parameterTypeIDs)
524template <
typename Derived,
typename KeyType,
typename UnversionedDataType>
525class VersionedTableInfo {
526 Derived &asDerived() {
return *
static_cast<Derived *
>(
this); }
528 const Derived &asDerived()
const {
529 return *
static_cast<const Derived *
>(
this);
533 using key_type = KeyType;
534 using key_type_ref = key_type;
536 llvm::SmallVector<std::pair<llvm::VersionTuple, UnversionedDataType>, 1>;
537 using data_type_ref = data_type &;
538 using hash_value_type =
size_t;
539 using offset_type = unsigned;
541 std::pair<unsigned, unsigned>
542 EmitKeyDataLength(raw_ostream &OS, key_type_ref Key, data_type_ref Data) {
543 uint32_t KeyLength = asDerived().getKeyLength(Key);
545 getVersionedInfoSize(Data, [
this](
const UnversionedDataType &UI) {
546 return asDerived().getUnversionedInfoSize(UI);
549 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
552 return {KeyLength, DataLength};
555 void EmitData(raw_ostream &OS, key_type_ref, data_type_ref Data,
unsigned) {
557 OS, Data, [
this](llvm::raw_ostream &OS,
const UnversionedDataType &UI) {
558 asDerived().emitUnversionedInfo(OS, UI);
564void emitCommonEntityInfo(raw_ostream &OS,
const CommonEntityInfo &CEI) {
565 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
568 if (
auto safety = CEI.getSwiftSafety()) {
569 payload =
static_cast<unsigned>(*safety);
574 if (
auto swiftPrivate = CEI.isSwiftPrivate()) {
580 payload |= CEI.Unavailable;
582 payload |= CEI.UnavailableInSwift;
584 writer.write<
uint8_t>(payload);
586 writer.write<
uint16_t>(CEI.UnavailableMsg.size());
587 OS.write(CEI.UnavailableMsg.c_str(), CEI.UnavailableMsg.size());
589 writer.write<
uint16_t>(CEI.SwiftName.size());
590 OS.write(CEI.SwiftName.c_str(), CEI.SwiftName.size());
595unsigned getCommonEntityInfoSize(
const CommonEntityInfo &CEI) {
596 return 5 + CEI.UnavailableMsg.size() + CEI.SwiftName.size();
601unsigned getCommonTypeInfoSize(
const CommonTypeInfo &CTI) {
602 return 2 + (CTI.getSwiftBridge() ? CTI.getSwiftBridge()->size() : 0) + 2 +
603 (CTI.getNSErrorDomain() ? CTI.getNSErrorDomain()->size() : 0) + 2 +
604 (CTI.getSwiftConformance() ? CTI.getSwiftConformance()->size() : 0) +
605 getCommonEntityInfoSize(CTI);
609void emitCommonTypeInfo(raw_ostream &OS,
const CommonTypeInfo &CTI) {
610 emitCommonEntityInfo(OS, CTI);
612 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
613 if (
auto swiftBridge = CTI.getSwiftBridge()) {
614 writer.write<
uint16_t>(swiftBridge->size() + 1);
615 OS.write(swiftBridge->c_str(), swiftBridge->size());
619 if (
auto nsErrorDomain = CTI.getNSErrorDomain()) {
620 writer.write<
uint16_t>(nsErrorDomain->size() + 1);
621 OS.write(nsErrorDomain->c_str(), CTI.getNSErrorDomain()->size());
625 if (
auto conformance = CTI.getSwiftConformance()) {
626 writer.write<
uint16_t>(conformance->size() + 1);
627 OS.write(conformance->c_str(), conformance->size());
634class ContextInfoTableInfo
635 :
public VersionedTableInfo<ContextInfoTableInfo, unsigned, ContextInfo> {
637 unsigned getKeyLength(key_type_ref) {
return sizeof(
uint32_t); }
639 void EmitKey(raw_ostream &OS, key_type_ref Key,
unsigned) {
640 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
648 unsigned getUnversionedInfoSize(
const ContextInfo &OCI) {
649 return getCommonTypeInfoSize(OCI) + 1;
652 void emitUnversionedInfo(raw_ostream &OS,
const ContextInfo &OCI) {
653 emitCommonTypeInfo(OS, OCI);
656 if (
auto swiftImportAsNonGeneric = OCI.getSwiftImportAsNonGeneric())
657 payload |= (0x01 << 1) | (
uint8_t)swiftImportAsNonGeneric.value();
659 if (
auto swiftObjCMembers = OCI.getSwiftObjCMembers())
660 payload |= (0x01 << 1) | (
uint8_t)swiftObjCMembers.value();
662 if (
auto nullable = OCI.getDefaultNullability())
663 payload |= (0x01 << 2) |
static_cast<uint8_t>(*nullable);
664 payload = (payload << 1) | (OCI.hasDesignatedInits() ? 1 : 0);
671void APINotesWriter::Implementation::writeContextBlock(
672 llvm::BitstreamWriter &Stream) {
675 if (Contexts.empty())
679 llvm::SmallString<4096> HashTableBlob;
682 llvm::OnDiskChainedHashTableGenerator<ContextIDTableInfo>
Generator;
683 for (
auto &OC : Contexts)
684 Generator.insert(OC.first, OC.second.first);
686 llvm::raw_svector_ostream BlobStream(HashTableBlob);
688 llvm::support::endian::write<uint32_t>(BlobStream, 0,
689 llvm::endianness::little);
694 ContextID.emit(Scratch, Offset, HashTableBlob);
698 llvm::SmallString<4096> HashTableBlob;
701 llvm::OnDiskChainedHashTableGenerator<ContextInfoTableInfo>
Generator;
702 for (
auto &OC : Contexts)
703 Generator.insert(OC.second.first, OC.second.second);
705 llvm::raw_svector_ostream BlobStream(HashTableBlob);
707 llvm::support::endian::write<uint32_t>(BlobStream, 0,
708 llvm::endianness::little);
713 ContextInfo.emit(Scratch, Offset, HashTableBlob);
720unsigned getVariableInfoSize(
const VariableInfo &VI) {
721 return 2 + getCommonEntityInfoSize(VI) + 2 + VI.getType().size();
723unsigned getParamInfoSize(
const ParamInfo &PI);
726void emitVariableInfo(raw_ostream &OS,
const VariableInfo &VI) {
727 emitCommonEntityInfo(OS, VI);
730 if (
auto nullable = VI.getNullability()) {
737 OS.write(
reinterpret_cast<const char *
>(
bytes), 2);
739 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
740 writer.write<
uint16_t>(VI.getType().size());
741 OS.write(VI.getType().data(), VI.getType().size());
745class ObjCPropertyTableInfo
746 :
public VersionedTableInfo<ObjCPropertyTableInfo,
747 std::tuple<unsigned, unsigned, char>,
750 unsigned getKeyLength(key_type_ref) {
754 void EmitKey(raw_ostream &OS, key_type_ref Key,
unsigned) {
755 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
756 writer.write<
uint32_t>(std::get<0>(Key));
757 writer.write<
uint32_t>(std::get<1>(Key));
758 writer.write<
uint8_t>(std::get<2>(Key));
765 unsigned getUnversionedInfoSize(
const ObjCPropertyInfo &OPI) {
766 return getVariableInfoSize(OPI) + 1;
769 void emitUnversionedInfo(raw_ostream &OS,
const ObjCPropertyInfo &OPI) {
770 emitVariableInfo(OS, OPI);
773 if (
auto value = OPI.getSwiftImportAsAccessors()) {
775 flags |= value.value() << 1;
782void APINotesWriter::Implementation::writeObjCPropertyBlock(
783 llvm::BitstreamWriter &Stream) {
786 if (ObjCProperties.empty())
790 llvm::SmallString<4096> HashTableBlob;
793 llvm::OnDiskChainedHashTableGenerator<ObjCPropertyTableInfo>
Generator;
794 for (
auto &OP : ObjCProperties)
797 llvm::raw_svector_ostream BlobStream(HashTableBlob);
799 llvm::support::endian::write<uint32_t>(BlobStream, 0,
800 llvm::endianness::little);
805 ObjCPropertyData.emit(Scratch, Offset, HashTableBlob);
810unsigned getFunctionInfoSize(
const FunctionInfo &);
811void emitFunctionInfo(llvm::raw_ostream &,
const FunctionInfo &);
812void emitParamInfo(raw_ostream &OS,
const ParamInfo &PI);
815class ObjCMethodTableInfo
816 :
public VersionedTableInfo<ObjCMethodTableInfo,
817 std::tuple<unsigned, unsigned, char>,
820 unsigned getKeyLength(key_type_ref) {
824 void EmitKey(raw_ostream &OS, key_type_ref Key,
unsigned) {
825 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
826 writer.write<
uint32_t>(std::get<0>(Key));
827 writer.write<
uint32_t>(std::get<1>(Key));
828 writer.write<
uint8_t>(std::get<2>(Key));
835 unsigned getUnversionedInfoSize(
const ObjCMethodInfo &OMI) {
836 auto size = getFunctionInfoSize(OMI) + 1;
838 size += getParamInfoSize(*OMI.Self);
842 void emitUnversionedInfo(raw_ostream &OS,
const ObjCMethodInfo &OMI) {
844 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
845 flags = (flags << 1) | OMI.DesignatedInit;
846 flags = (flags << 1) | OMI.RequiredInit;
847 flags = (flags << 1) | static_cast<bool>(OMI.Self);
850 emitFunctionInfo(OS, OMI);
853 emitParamInfo(OS, *OMI.Self);
858class CXXMethodTableInfo
859 :
public VersionedTableInfo<CXXMethodTableInfo, FunctionTableKey,
862 unsigned getKeyLength(key_type_ref Key) {
863 return getFunctionTableKeyLength(Key);
866 void EmitKey(raw_ostream &OS, key_type_ref Key,
unsigned) {
867 emitFunctionTableKey(OS, Key);
871 return static_cast<size_t>(key.hashValue());
874 unsigned getUnversionedInfoSize(
const CXXMethodInfo &MI) {
875 auto size = getFunctionInfoSize(MI) + 1;
877 size += getParamInfoSize(*MI.This);
881 void emitUnversionedInfo(raw_ostream &OS,
const CXXMethodInfo &MI) {
883 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
884 flags = (flags << 1) | static_cast<bool>(MI.This);
887 emitFunctionInfo(OS, MI);
889 emitParamInfo(OS, *MI.This);
894void APINotesWriter::Implementation::writeObjCMethodBlock(
895 llvm::BitstreamWriter &Stream) {
898 if (ObjCMethods.empty())
902 llvm::SmallString<4096> HashTableBlob;
905 llvm::OnDiskChainedHashTableGenerator<ObjCMethodTableInfo>
Generator;
906 for (
auto &OM : ObjCMethods)
909 llvm::raw_svector_ostream BlobStream(HashTableBlob);
911 llvm::support::endian::write<uint32_t>(BlobStream, 0,
912 llvm::endianness::little);
917 ObjCMethodData.emit(Scratch, Offset, HashTableBlob);
921void APINotesWriter::Implementation::writeCXXMethodBlock(
922 llvm::BitstreamWriter &Stream) {
925 if (CXXMethods.empty())
929 llvm::SmallString<4096> HashTableBlob;
932 llvm::OnDiskChainedHashTableGenerator<CXXMethodTableInfo>
Generator;
933 for (
auto &MD : CXXMethods)
936 llvm::raw_svector_ostream BlobStream(HashTableBlob);
938 llvm::support::endian::write<uint32_t>(BlobStream, 0,
939 llvm::endianness::little);
944 CXXMethodData.emit(Scratch, Offset, HashTableBlob);
951 :
public VersionedTableInfo<FieldTableInfo, SingleDeclTableKey, FieldInfo> {
953 unsigned getKeyLength(key_type_ref) {
957 void EmitKey(raw_ostream &OS, key_type_ref Key,
unsigned) {
958 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
959 writer.write<
uint32_t>(Key.parentContextID);
964 return static_cast<size_t>(key.hashValue());
967 unsigned getUnversionedInfoSize(
const FieldInfo &FI) {
968 return getVariableInfoSize(FI);
971 void emitUnversionedInfo(raw_ostream &OS,
const FieldInfo &FI) {
972 emitVariableInfo(OS, FI);
977void APINotesWriter::Implementation::writeFieldBlock(
978 llvm::BitstreamWriter &Stream) {
985 llvm::SmallString<4096> HashTableBlob;
988 llvm::OnDiskChainedHashTableGenerator<FieldTableInfo>
Generator;
989 for (
auto &FD : Fields)
992 llvm::raw_svector_ostream BlobStream(HashTableBlob);
994 llvm::support::endian::write<uint32_t>(BlobStream, 0,
995 llvm::endianness::little);
1000 FieldData.emit(Scratch, Offset, HashTableBlob);
1006class ObjCSelectorTableInfo {
1008 using key_type = StoredObjCSelector;
1009 using key_type_ref =
const key_type &;
1011 using data_type_ref = data_type;
1012 using hash_value_type = unsigned;
1013 using offset_type = unsigned;
1016 return llvm::DenseMapInfo<StoredObjCSelector>::getHashValue(Key);
1019 std::pair<unsigned, unsigned>
1020 EmitKeyDataLength(raw_ostream &OS, key_type_ref Key, data_type_ref) {
1025 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
1027 writer.write<
uint16_t>(DataLength);
1028 return {KeyLength, DataLength};
1031 void EmitKey(raw_ostream &OS, key_type_ref Key,
unsigned) {
1032 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
1033 writer.write<
uint16_t>(Key.NumArgs);
1034 for (
auto Identifier : Key.Identifiers)
1035 writer.write<
uint32_t>(Identifier);
1038 void EmitData(raw_ostream &OS, key_type_ref, data_type_ref Data,
unsigned) {
1039 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
1045void APINotesWriter::Implementation::writeObjCSelectorBlock(
1046 llvm::BitstreamWriter &Stream) {
1049 if (SelectorIDs.empty())
1053 llvm::SmallString<4096> HashTableBlob;
1056 llvm::OnDiskChainedHashTableGenerator<ObjCSelectorTableInfo>
Generator;
1057 for (
auto &S : SelectorIDs)
1060 llvm::raw_svector_ostream BlobStream(HashTableBlob);
1062 llvm::support::endian::write<uint32_t>(BlobStream, 0,
1063 llvm::endianness::little);
1068 ObjCSelectorData.emit(Scratch, Offset, HashTableBlob);
1074class GlobalVariableTableInfo
1075 :
public VersionedTableInfo<GlobalVariableTableInfo, SingleDeclTableKey,
1076 GlobalVariableInfo> {
1078 unsigned getKeyLength(key_type_ref) {
1082 void EmitKey(raw_ostream &OS, key_type_ref Key,
unsigned) {
1083 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
1084 writer.write<
uint32_t>(Key.parentContextID);
1085 writer.write<
uint32_t>(Key.nameID);
1089 return static_cast<size_t>(Key.hashValue());
1092 unsigned getUnversionedInfoSize(
const GlobalVariableInfo &GVI) {
1093 return getVariableInfoSize(GVI);
1096 void emitUnversionedInfo(raw_ostream &OS,
const GlobalVariableInfo &GVI) {
1097 emitVariableInfo(OS, GVI);
1102void APINotesWriter::Implementation::writeGlobalVariableBlock(
1103 llvm::BitstreamWriter &Stream) {
1106 if (GlobalVariables.empty())
1110 llvm::SmallString<4096> HashTableBlob;
1113 llvm::OnDiskChainedHashTableGenerator<GlobalVariableTableInfo>
Generator;
1114 for (
auto &GV : GlobalVariables)
1117 llvm::raw_svector_ostream BlobStream(HashTableBlob);
1119 llvm::support::endian::write<uint32_t>(BlobStream, 0,
1120 llvm::endianness::little);
1125 GlobalVariableData.emit(Scratch, Offset, HashTableBlob);
1130void emitBoundsSafetyInfo(raw_ostream &OS,
const BoundsSafetyInfo &BSI) {
1131 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
1133 if (
auto kind = BSI.getKind()) {
1139 if (
auto level = BSI.getLevel()) {
1140 assert(*level < (1u << 3));
1142 flags |= (
uint8_t)*level << 1;
1146 writer.write<
uint16_t>(BSI.ExternalBounds.size());
1148 ArrayRef<char>{BSI.ExternalBounds.data(), BSI.ExternalBounds.size()});
1151unsigned getBoundsSafetyInfoSize(
const BoundsSafetyInfo &BSI) {
1152 return 1 +
sizeof(
uint16_t) + BSI.ExternalBounds.size();
1155unsigned getParamInfoSize(
const ParamInfo &PI) {
1156 unsigned BSISize = 0;
1157 if (
auto BSI = PI.BoundsSafety)
1158 BSISize = getBoundsSafetyInfoSize(*BSI);
1159 return getVariableInfoSize(PI) + 1 + BSISize;
1162void emitParamInfo(raw_ostream &OS,
const ParamInfo &PI) {
1163 emitVariableInfo(OS, PI);
1166 if (PI.BoundsSafety)
1169 if (
auto noescape = PI.isNoEscape()) {
1175 if (
auto lifetimebound = PI.isLifetimebound()) {
1181 if (
auto RCC = PI.getRetainCountConvention())
1182 flags |=
static_cast<uint8_t>(RCC.value()) + 1;
1184 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
1186 if (
auto BSI = PI.BoundsSafety)
1187 emitBoundsSafetyInfo(OS, *BSI);
1192unsigned getFunctionInfoSize(
const FunctionInfo &FI) {
1193 unsigned size = getCommonEntityInfoSize(FI) + 2 +
sizeof(
uint64_t);
1195 for (
const auto &P : FI.Params)
1196 size += getParamInfoSize(P);
1197 size +=
sizeof(
uint16_t) + FI.ResultType.size();
1198 size +=
sizeof(
uint16_t) + FI.SwiftReturnOwnership.size();
1203void emitFunctionInfo(raw_ostream &OS,
const FunctionInfo &FI) {
1204 emitCommonEntityInfo(OS, FI);
1207 flags |= FI.NullabilityAudited;
1209 if (
auto RCC = FI.getRetainCountConvention())
1210 flags |=
static_cast<uint8_t>(RCC.value()) + 1;
1212 flags |= FI.UnsafeBufferUsage;
1214 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
1217 writer.write<
uint8_t>(FI.NumAdjustedNullable);
1218 writer.write<
uint64_t>(FI.NullabilityPayload);
1220 writer.write<
uint16_t>(FI.Params.size());
1221 for (
const auto &PI : FI.Params)
1222 emitParamInfo(OS, PI);
1224 writer.write<
uint16_t>(FI.ResultType.size());
1225 writer.write(ArrayRef<char>{FI.ResultType});
1226 writer.write<
uint16_t>(FI.SwiftReturnOwnership.size());
1227 writer.write(ArrayRef<char>{FI.SwiftReturnOwnership});
1231class GlobalFunctionTableInfo
1232 :
public VersionedTableInfo<GlobalFunctionTableInfo, FunctionTableKey,
1233 GlobalFunctionInfo> {
1235 unsigned getKeyLength(key_type_ref Key) {
1236 return getFunctionTableKeyLength(Key);
1239 void EmitKey(raw_ostream &OS, key_type_ref Key,
unsigned) {
1240 emitFunctionTableKey(OS, Key);
1244 return static_cast<size_t>(Key.hashValue());
1247 unsigned getUnversionedInfoSize(
const GlobalFunctionInfo &GFI) {
1248 return getFunctionInfoSize(GFI);
1251 void emitUnversionedInfo(raw_ostream &OS,
const GlobalFunctionInfo &GFI) {
1252 emitFunctionInfo(OS, GFI);
1257void APINotesWriter::Implementation::writeGlobalFunctionBlock(
1258 llvm::BitstreamWriter &Stream) {
1261 if (GlobalFunctions.empty())
1265 llvm::SmallString<4096> HashTableBlob;
1268 llvm::OnDiskChainedHashTableGenerator<GlobalFunctionTableInfo>
Generator;
1269 for (
auto &F : GlobalFunctions)
1272 llvm::raw_svector_ostream BlobStream(HashTableBlob);
1274 llvm::support::endian::write<uint32_t>(BlobStream, 0,
1275 llvm::endianness::little);
1280 GlobalFunctionData.emit(Scratch, Offset, HashTableBlob);
1286class EnumConstantTableInfo
1287 :
public VersionedTableInfo<EnumConstantTableInfo, unsigned,
1290 unsigned getKeyLength(key_type_ref) {
return sizeof(
uint32_t); }
1292 void EmitKey(raw_ostream &OS, key_type_ref Key,
unsigned) {
1293 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
1301 unsigned getUnversionedInfoSize(
const EnumConstantInfo &ECI) {
1302 return getCommonEntityInfoSize(ECI);
1305 void emitUnversionedInfo(raw_ostream &OS,
const EnumConstantInfo &ECI) {
1306 emitCommonEntityInfo(OS, ECI);
1311void APINotesWriter::Implementation::writeEnumConstantBlock(
1312 llvm::BitstreamWriter &Stream) {
1315 if (EnumConstants.empty())
1319 llvm::SmallString<4096> HashTableBlob;
1322 llvm::OnDiskChainedHashTableGenerator<EnumConstantTableInfo>
Generator;
1323 for (
auto &EC : EnumConstants)
1326 llvm::raw_svector_ostream BlobStream(HashTableBlob);
1328 llvm::support::endian::write<uint32_t>(BlobStream, 0,
1329 llvm::endianness::little);
1334 EnumConstantData.emit(Scratch, Offset, HashTableBlob);
1339template <
typename Derived,
typename UnversionedDataType>
1340class CommonTypeTableInfo
1341 :
public VersionedTableInfo<Derived, SingleDeclTableKey,
1342 UnversionedDataType> {
1344 using key_type_ref =
typename CommonTypeTableInfo::key_type_ref;
1345 using hash_value_type =
typename CommonTypeTableInfo::hash_value_type;
1347 unsigned getKeyLength(key_type_ref) {
1348 return sizeof(
uint32_t) +
sizeof(IdentifierID);
1351 void EmitKey(raw_ostream &OS, key_type_ref Key,
unsigned) {
1352 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
1353 writer.write<
uint32_t>(Key.parentContextID);
1358 return static_cast<size_t>(Key.hashValue());
1361 unsigned getUnversionedInfoSize(
const UnversionedDataType &UDT) {
1362 return getCommonTypeInfoSize(UDT);
1365 void emitUnversionedInfo(raw_ostream &OS,
const UnversionedDataType &UDT) {
1366 emitCommonTypeInfo(OS, UDT);
1371class TagTableInfo :
public CommonTypeTableInfo<TagTableInfo, TagInfo> {
1373 unsigned getUnversionedInfoSize(
const TagInfo &TI) {
1375 return 2 + (TI.SwiftImportAs ? TI.SwiftImportAs->size() : 0) +
1376 2 + (TI.SwiftRetainOp ? TI.SwiftRetainOp->size() : 0) +
1377 2 + (TI.SwiftReleaseOp ? TI.SwiftReleaseOp->size() : 0) +
1378 2 + (TI.SwiftDestroyOp ? TI.SwiftDestroyOp->size() : 0) +
1379 2 + (TI.SwiftDefaultOwnership ? TI.SwiftDefaultOwnership->size() : 0) +
1380 3 + getCommonTypeInfoSize(TI);
1384 void emitUnversionedInfo(raw_ostream &OS,
const TagInfo &TI) {
1385 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
1388 if (
auto extensibility = TI.EnumExtensibility) {
1389 Flags |=
static_cast<uint8_t>(extensibility.value()) + 1;
1390 assert((Flags < (1 << 2)) &&
"must fit in two bits");
1394 if (
auto value = TI.isFlagEnum())
1395 Flags |= (value.value() << 1 | 1 << 0);
1399 if (
auto Copyable = TI.isSwiftCopyable())
1404 if (
auto Escapable = TI.isSwiftEscapable())
1409 if (
auto ImportAs = TI.SwiftImportAs) {
1410 writer.write<
uint16_t>(ImportAs->size() + 1);
1411 OS.write(ImportAs->c_str(), ImportAs->size());
1415 if (
auto RetainOp = TI.SwiftRetainOp) {
1416 writer.write<
uint16_t>(RetainOp->size() + 1);
1417 OS.write(RetainOp->c_str(), RetainOp->size());
1421 if (
auto ReleaseOp = TI.SwiftReleaseOp) {
1422 writer.write<
uint16_t>(ReleaseOp->size() + 1);
1423 OS.write(ReleaseOp->c_str(), ReleaseOp->size());
1427 if (
auto DefaultOwnership = TI.SwiftDefaultOwnership) {
1428 writer.write<
uint16_t>(DefaultOwnership->size() + 1);
1429 OS.write(DefaultOwnership->c_str(), DefaultOwnership->size());
1433 if (
auto DestroyOp = TI.SwiftDestroyOp) {
1434 writer.write<
uint16_t>(DestroyOp->size() + 1);
1435 OS.write(DestroyOp->c_str(), DestroyOp->size());
1440 emitCommonTypeInfo(OS, TI);
1445void APINotesWriter::Implementation::writeTagBlock(
1446 llvm::BitstreamWriter &Stream) {
1453 llvm::SmallString<4096> HashTableBlob;
1456 llvm::OnDiskChainedHashTableGenerator<TagTableInfo>
Generator;
1457 for (
auto &T : Tags)
1460 llvm::raw_svector_ostream BlobStream(HashTableBlob);
1462 llvm::support::endian::write<uint32_t>(BlobStream, 0,
1463 llvm::endianness::little);
1468 TagData.emit(Scratch, Offset, HashTableBlob);
1474class TypedefTableInfo
1475 :
public CommonTypeTableInfo<TypedefTableInfo, TypedefInfo> {
1477 unsigned getUnversionedInfoSize(
const TypedefInfo &TI) {
1478 return 1 + getCommonTypeInfoSize(TI);
1481 void emitUnversionedInfo(raw_ostream &OS,
const TypedefInfo &TI) {
1482 llvm::support::endian::Writer writer(OS, llvm::endianness::little);
1485 if (
auto swiftWrapper = TI.SwiftWrapper)
1486 Flags |=
static_cast<uint8_t>(*swiftWrapper) + 1;
1490 emitCommonTypeInfo(OS, TI);
1495void APINotesWriter::Implementation::writeTypedefBlock(
1496 llvm::BitstreamWriter &Stream) {
1499 if (Typedefs.empty())
1503 llvm::SmallString<4096> HashTableBlob;
1506 llvm::OnDiskChainedHashTableGenerator<TypedefTableInfo>
Generator;
1507 for (
auto &T : Typedefs)
1510 llvm::raw_svector_ostream BlobStream(HashTableBlob);
1512 llvm::support::endian::write<uint32_t>(BlobStream, 0,
1513 llvm::endianness::little);
1518 TypedefData.emit(Scratch, Offset, HashTableBlob);
1536 llvm::VersionTuple SwiftVersion) {
1539 uint32_t RawParentCtxID = ParentCtxID ? ParentCtxID->Value : -1;
1545 Implementation::VersionedSmallVector<ContextInfo> EmptyVersionedInfo;
1547 .insert(std::make_pair(
1548 Key, std::make_pair(NextID, EmptyVersionedInfo)))
1557 auto &VersionedVec = Known->second.second;
1559 for (
auto &Versioned : VersionedVec) {
1560 if (Versioned.first == SwiftVersion) {
1561 Versioned.second |= Info;
1568 VersionedVec.push_back({SwiftVersion, Info});
1574 bool IsInstanceProperty,
1576 VersionTuple SwiftVersion) {
1579 ->ObjCProperties[std::make_tuple(CtxID.
Value, NameID, IsInstanceProperty)]
1580 .push_back({SwiftVersion, Info});
1584 bool IsInstanceMethod,
1586 VersionTuple SwiftVersion) {
1588 auto Key = std::tuple<unsigned, unsigned, char>{CtxID.
Value, SelID,
1590 Implementation->ObjCMethods[Key].push_back({SwiftVersion, Info});
1603 for (
auto &Versioned : VersionedVec) {
1604 if (Versioned.first == SwiftVersion) {
1605 Versioned.second.setHasDesignatedInits(
true);
1612 VersionedVec.push_back({SwiftVersion,
ContextInfo()});
1613 VersionedVec.back().second.setHasDesignatedInits(
true);
1620 VersionTuple SwiftVersion) {
1622 Implementation->CXXMethods[Key].push_back({SwiftVersion, Info});
1627 const CXXMethodInfo &Info,
1628 VersionTuple SwiftVersion) {
1629 FunctionTableKey Key =
1630 Implementation->getFunctionKey(CtxID.Value, Name, Parameters);
1631 Implementation->CXXMethods[Key].push_back({SwiftVersion, Info});
1636 VersionTuple SwiftVersion) {
1643 llvm::StringRef Name,
1645 VersionTuple SwiftVersion) {
1648 Implementation->GlobalVariables[Key].push_back({SwiftVersion, Info});
1652 llvm::StringRef Name,
1654 VersionTuple SwiftVersion) {
1656 Implementation->GlobalFunctions[Key].push_back({SwiftVersion, Info});
1660 std::optional<Context> Ctx, llvm::StringRef Name,
1662 VersionTuple SwiftVersion) {
1663 FunctionTableKey Key = Implementation->getFunctionKey(Ctx, Name, Parameters);
1664 Implementation->GlobalFunctions[Key].push_back({SwiftVersion, Info});
1669 VersionTuple SwiftVersion) {
1671 Implementation->EnumConstants[EnumConstantID].push_back({SwiftVersion, Info});
1675 const TagInfo &Info, VersionTuple SwiftVersion) {
1683 VersionTuple SwiftVersion) {
#define BLOCK_RECORD(NameSpace, Block)
static StringRef bytes(const std::vector< T, Allocator > &v)
Defines the clang::FileManager interface and associated types.
static void emitRecordID(unsigned ID, const char *Name, llvm::BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record)
static void emitBlockID(unsigned ID, const char *Name, llvm::BitstreamWriter &Stream, SmallVectorImpl< uint64_t > &Record)
*collection of selector each with an associated kind and an ordered *collection of selectors A selector has a kind
static StringRef getIdentifier(const Token &Tok)
#define BLOCK(DERIVED, BASE)
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
Cached information about one file (either on disk or in the virtual file system).
Smart pointer class that efficiently represents Objective-C method names.
friend class APINotesWriter
void writeToStream(llvm::raw_ostream &OS)
Implementation(llvm::StringRef ModuleName, const FileEntry *SF)
void addObjCMethod(ContextID CtxID, ObjCSelectorRef Selector, bool IsInstanceMethod, const ObjCMethodInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a specific Objective-C method.
void addEnumConstant(llvm::StringRef Name, const EnumConstantInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about an enumerator.
ContextID addContext(std::optional< ContextID > ParentCtxID, llvm::StringRef Name, ContextKind Kind, const ContextInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a specific Objective-C class or protocol or a C++ namespace.
void addGlobalFunction(std::optional< Context > Ctx, llvm::StringRef Name, const GlobalFunctionInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a global function.
void addObjCProperty(ContextID CtxID, llvm::StringRef Name, bool IsInstanceProperty, const ObjCPropertyInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a specific Objective-C property.
void addField(ContextID CtxID, llvm::StringRef Name, const FieldInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a specific C record field.
void addGlobalVariable(std::optional< Context > Ctx, llvm::StringRef Name, const GlobalVariableInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a global variable.
void addTypedef(std::optional< Context > Ctx, llvm::StringRef Name, const TypedefInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a typedef.
void writeToStream(llvm::raw_ostream &OS)
void addCXXMethod(ContextID CtxID, llvm::StringRef Name, const CXXMethodInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a specific C++ method.
void addTag(std::optional< Context > Ctx, llvm::StringRef Name, const TagInfo &Info, llvm::VersionTuple SwiftVersion)
Add information about a tag (struct/union/enum/C++ class).
APINotesWriter(llvm::StringRef ModuleName, const FileEntry *SF)
Create a new API notes writer with the given module name and (optional) source file.
Describes API notes data for a C++ method.
Opaque context ID used to refer to an Objective-C class or protocol or a C++ namespace.
Describes API notes data for an Objective-C class or protocol or a C++ namespace.
Describes API notes data for an enumerator.
Describes API notes data for a C/C++ record field.
Describes API notes data for a global function.
Describes API notes data for a global variable.
Describes API notes data for an Objective-C method.
unsigned DesignatedInit
Whether this is a designated initializer of its class.
Describes API notes data for an Objective-C property.
Describes API notes data for a tag.
Describes API notes data for a typedef.
llvm::BCRecordLayout< CONTEXT_INFO_DATA, llvm::BCVBR< 16 >, llvm::BCBlob > ContextInfoLayout
llvm::BCRecordLayout< CONTEXT_ID_DATA, llvm::BCVBR< 16 >, llvm::BCBlob > ContextIDLayout
llvm::BCRecordLayout< MODULE_NAME, llvm::BCBlob > ModuleNameLayout
llvm::BCRecordLayout< SOURCE_FILE, llvm::BCVBR< 16 >, llvm::BCVBR< 16 > > SourceFileLayout
llvm::BCRecordLayout< METADATA, llvm::BCFixed< 16 >, llvm::BCFixed< 16 > > MetadataLayout
llvm::BCRecordLayout< CXX_METHOD_DATA, llvm::BCVBR< 16 >, llvm::BCBlob > CXXMethodDataLayout
llvm::BCRecordLayout< ENUM_CONSTANT_DATA, llvm::BCVBR< 16 >, llvm::BCBlob > EnumConstantDataLayout
llvm::BCRecordLayout< FIELD_DATA, llvm::BCVBR< 16 >, llvm::BCBlob > FieldDataLayout
llvm::BCRecordLayout< GLOBAL_FUNCTION_DATA, llvm::BCVBR< 16 >, llvm::BCBlob > GlobalFunctionDataLayout
llvm::BCRecordLayout< GLOBAL_VARIABLE_DATA, llvm::BCVBR< 16 >, llvm::BCBlob > GlobalVariableDataLayout
llvm::BCRecordLayout< IDENTIFIER_DATA, llvm::BCVBR< 16 >, llvm::BCBlob > IdentifierDataLayout
llvm::BCRecordLayout< OBJC_METHOD_DATA, llvm::BCVBR< 16 >, llvm::BCBlob > ObjCMethodDataLayout
llvm::BCRecordLayout< OBJC_PROPERTY_DATA, llvm::BCVBR< 16 >, llvm::BCBlob > ObjCPropertyDataLayout
llvm::BCRecordLayout< OBJC_SELECTOR_DATA, llvm::BCVBR< 16 >, llvm::BCBlob > ObjCSelectorDataLayout
llvm::BCRecordLayout< TAG_DATA, llvm::BCVBR< 16 >, llvm::BCBlob > TagDataLayout
llvm::BCRecordLayout< TYPEDEF_DATA, llvm::BCVBR< 16 >, llvm::BCBlob > TypedefDataLayout
constexpr unsigned FunctionTableKeyBaseLength
llvm::PointerEmbeddedInt< unsigned, 31 > IdentifierID
llvm::PointerEmbeddedInt< unsigned, 31 > SelectorID
std::optional< FunctionTableKey > getFunctionKeyImpl(uint32_t ParentContextID, llvm::StringRef Name, GetIdentifierFn GetIdentifier)
const uint8_t kSwiftConforms
const uint8_t kSwiftDoesNotConform
constexpr uint8_t FunctionKeyHasParameterSelector
A stored C or C++ function declaration, represented by the ID of its parent context,...
const uint16_t VERSION_MAJOR
API notes file major version number.
const unsigned char API_NOTES_SIGNATURE[]
Magic number for API notes files.
const uint16_t VERSION_MINOR
API notes file minor version number.
@ OBJC_CONTEXT_BLOCK_ID
The Objective-C context data block, which contains information about Objective-C classes and protocol...
@ TYPEDEF_BLOCK_ID
The typedef data block, which maps typedef names to information about the typedefs.
@ OBJC_PROPERTY_BLOCK_ID
The Objective-C property data block, which maps Objective-C (class name, property name) pairs to info...
@ ENUM_CONSTANT_BLOCK_ID
The enum constant data block, which maps enumerator names to information about the enumerators.
@ TAG_BLOCK_ID
The tag data block, which maps tag names to information about the tags.
@ OBJC_METHOD_BLOCK_ID
The Objective-C property data block, which maps Objective-C (class name, selector,...
@ FIELD_BLOCK_ID
The fields data block, which maps names fields of C records to information about the field.
@ OBJC_SELECTOR_BLOCK_ID
The Objective-C selector data block, which maps Objective-C selector names (# of pieces,...
@ CXX_METHOD_BLOCK_ID
The C++ method data block, which maps C++ (context id, method name) pairs to information about the me...
@ GLOBAL_FUNCTION_BLOCK_ID
The (global) functions data block, which maps global function names to information about the global f...
@ CONTROL_BLOCK_ID
The control block, which contains all of the information that needs to be validated prior to committi...
@ IDENTIFIER_BLOCK_ID
The identifier data block, which maps identifier strings to IDs.
@ GLOBAL_VARIABLE_BLOCK_ID
The global variables data block, which maps global variable names to information about the global var...
@ OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject,...
uint32_t SelectorID
An ID number that refers to an ObjC selector in an AST file.
uint64_t TypeID
An ID number that refers to a type in an AST file.
unsigned ComputeHash(Selector Sel)
uint64_t IdentifierID
An ID number that refers to an identifier in an AST file.
The JSON file list parser is used to communicate input to InstallAPI.
hash_code hash_value(const clang::dependencies::ModuleID &ID)
__packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 __packed_splat2 uint8_t
__packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 __packed_splat2 __packed_splat4 uint16_t
__packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 __packed_splat2 __packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 uint32_t
A stored Objective-C or C++ context, represented by the ID of its parent context, the kind of this co...
A temporary reference to an Objective-C selector, suitable for referencing selector data on the stack...
A stored Objective-C or C++ declaration, represented by the ID of its parent context,...