#include "clang/APINotes/APINotesReader.h"
#include "APINotesFormat.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Bitstream/BitstreamReader.h"
#include "llvm/Support/DJB.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/OnDiskHashTable.h"
namespace clang {
namespace api_notes {
usingnamespacellvm::support;
namespace {
llvm::VersionTuple ReadVersionTuple(const uint8_t *&Data) { … }
template <typename Derived, typename KeyType, typename UnversionedDataType>
class VersionedTableInfo { … };
void ReadCommonEntityInfo(const uint8_t *&Data, CommonEntityInfo &Info) { … }
void ReadCommonTypeInfo(const uint8_t *&Data, CommonTypeInfo &Info) { … }
class IdentifierTableInfo { … };
class ContextIDTableInfo { … };
class ContextInfoTableInfo
: public VersionedTableInfo<ContextInfoTableInfo, unsigned, ContextInfo> { … };
void ReadVariableInfo(const uint8_t *&Data, VariableInfo &Info) { … }
class ObjCPropertyTableInfo
: public VersionedTableInfo<ObjCPropertyTableInfo,
std::tuple<uint32_t, uint32_t, uint8_t>,
ObjCPropertyInfo> { … };
class FieldTableInfo
: public VersionedTableInfo<FieldTableInfo, SingleDeclTableKey, FieldInfo> { … };
void ReadParamInfo(const uint8_t *&Data, ParamInfo &Info) { … }
void ReadFunctionInfo(const uint8_t *&Data, FunctionInfo &Info) { … }
class ObjCMethodTableInfo
: public VersionedTableInfo<ObjCMethodTableInfo,
std::tuple<uint32_t, uint32_t, uint8_t>,
ObjCMethodInfo> { … };
class ObjCSelectorTableInfo { … };
class GlobalVariableTableInfo
: public VersionedTableInfo<GlobalVariableTableInfo, SingleDeclTableKey,
GlobalVariableInfo> { … };
class GlobalFunctionTableInfo
: public VersionedTableInfo<GlobalFunctionTableInfo, SingleDeclTableKey,
GlobalFunctionInfo> { … };
class CXXMethodTableInfo
: public VersionedTableInfo<CXXMethodTableInfo, SingleDeclTableKey,
CXXMethodInfo> { … };
class EnumConstantTableInfo
: public VersionedTableInfo<EnumConstantTableInfo, uint32_t,
EnumConstantInfo> { … };
class TagTableInfo
: public VersionedTableInfo<TagTableInfo, SingleDeclTableKey, TagInfo> { … };
class TypedefTableInfo
: public VersionedTableInfo<TypedefTableInfo, SingleDeclTableKey,
TypedefInfo> { … };
}
class APINotesReader::Implementation { … };
std::optional<IdentifierID>
APINotesReader::Implementation::getIdentifier(llvm::StringRef Str) { … }
std::optional<SelectorID>
APINotesReader::Implementation::getSelector(ObjCSelectorRef Selector) { … }
bool APINotesReader::Implementation::readControlBlock(
llvm::BitstreamCursor &Cursor, llvm::SmallVectorImpl<uint64_t> &Scratch) { … }
bool APINotesReader::Implementation::readIdentifierBlock(
llvm::BitstreamCursor &Cursor, llvm::SmallVectorImpl<uint64_t> &Scratch) { … }
bool APINotesReader::Implementation::readContextBlock(
llvm::BitstreamCursor &Cursor, llvm::SmallVectorImpl<uint64_t> &Scratch) { … }
bool APINotesReader::Implementation::readObjCPropertyBlock(
llvm::BitstreamCursor &Cursor, llvm::SmallVectorImpl<uint64_t> &Scratch) { … }
bool APINotesReader::Implementation::readObjCMethodBlock(
llvm::BitstreamCursor &Cursor, llvm::SmallVectorImpl<uint64_t> &Scratch) { … }
bool APINotesReader::Implementation::readCXXMethodBlock(
llvm::BitstreamCursor &Cursor, llvm::SmallVectorImpl<uint64_t> &Scratch) { … }
bool APINotesReader::Implementation::readFieldBlock(
llvm::BitstreamCursor &Cursor, llvm::SmallVectorImpl<uint64_t> &Scratch) { … }
bool APINotesReader::Implementation::readObjCSelectorBlock(
llvm::BitstreamCursor &Cursor, llvm::SmallVectorImpl<uint64_t> &Scratch) { … }
bool APINotesReader::Implementation::readGlobalVariableBlock(
llvm::BitstreamCursor &Cursor, llvm::SmallVectorImpl<uint64_t> &Scratch) { … }
bool APINotesReader::Implementation::readGlobalFunctionBlock(
llvm::BitstreamCursor &Cursor, llvm::SmallVectorImpl<uint64_t> &Scratch) { … }
bool APINotesReader::Implementation::readEnumConstantBlock(
llvm::BitstreamCursor &Cursor, llvm::SmallVectorImpl<uint64_t> &Scratch) { … }
bool APINotesReader::Implementation::readTagBlock(
llvm::BitstreamCursor &Cursor, llvm::SmallVectorImpl<uint64_t> &Scratch) { … }
bool APINotesReader::Implementation::readTypedefBlock(
llvm::BitstreamCursor &Cursor, llvm::SmallVectorImpl<uint64_t> &Scratch) { … }
APINotesReader::APINotesReader(llvm::MemoryBuffer *InputBuffer,
llvm::VersionTuple SwiftVersion, bool &Failed)
: … { … }
APINotesReader::~APINotesReader() { … }
std::unique_ptr<APINotesReader>
APINotesReader::Create(std::unique_ptr<llvm::MemoryBuffer> InputBuffer,
llvm::VersionTuple SwiftVersion) { … }
template <typename T>
APINotesReader::VersionedInfo<T>::VersionedInfo(
llvm::VersionTuple Version,
llvm::SmallVector<std::pair<llvm::VersionTuple, T>, 1> R)
: … { … }
auto APINotesReader::lookupObjCClassID(llvm::StringRef Name)
-> std::optional<ContextID> { … }
auto APINotesReader::lookupObjCClassInfo(llvm::StringRef Name)
-> VersionedInfo<ContextInfo> { … }
auto APINotesReader::lookupObjCProtocolID(llvm::StringRef Name)
-> std::optional<ContextID> { … }
auto APINotesReader::lookupObjCProtocolInfo(llvm::StringRef Name)
-> VersionedInfo<ContextInfo> { … }
auto APINotesReader::lookupObjCProperty(ContextID CtxID, llvm::StringRef Name,
bool IsInstance)
-> VersionedInfo<ObjCPropertyInfo> { … }
auto APINotesReader::lookupObjCMethod(ContextID CtxID, ObjCSelectorRef Selector,
bool IsInstanceMethod)
-> VersionedInfo<ObjCMethodInfo> { … }
auto APINotesReader::lookupField(ContextID CtxID, llvm::StringRef Name)
-> VersionedInfo<FieldInfo> { … }
auto APINotesReader::lookupCXXMethod(ContextID CtxID, llvm::StringRef Name)
-> VersionedInfo<CXXMethodInfo> { … }
auto APINotesReader::lookupGlobalVariable(llvm::StringRef Name,
std::optional<Context> Ctx)
-> VersionedInfo<GlobalVariableInfo> { … }
auto APINotesReader::lookupGlobalFunction(llvm::StringRef Name,
std::optional<Context> Ctx)
-> VersionedInfo<GlobalFunctionInfo> { … }
auto APINotesReader::lookupEnumConstant(llvm::StringRef Name)
-> VersionedInfo<EnumConstantInfo> { … }
auto APINotesReader::lookupTagID(llvm::StringRef Name,
std::optional<Context> ParentCtx)
-> std::optional<ContextID> { … }
auto APINotesReader::lookupTag(llvm::StringRef Name, std::optional<Context> Ctx)
-> VersionedInfo<TagInfo> { … }
auto APINotesReader::lookupTypedef(llvm::StringRef Name,
std::optional<Context> Ctx)
-> VersionedInfo<TypedefInfo> { … }
auto APINotesReader::lookupNamespaceID(
llvm::StringRef Name, std::optional<ContextID> ParentNamespaceID)
-> std::optional<ContextID> { … }
}
}