#include "llvm/DebugInfo/CodeView/TypeStreamMerger.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h"
#include "llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h"
#include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/DebugInfo/CodeView/TypeIndexDiscovery.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/CodeView/TypeRecordHelpers.h"
#include "llvm/Support/Error.h"
#include <optional>
usingnamespacellvm;
usingnamespacellvm::codeview;
static inline size_t slotForIndex(TypeIndex Idx) { … }
namespace {
class TypeStreamMerger { … };
}
const TypeIndex TypeStreamMerger::Untranslated(SimpleTypeKind::NotTranslated);
void TypeStreamMerger::addMapping(TypeIndex Idx) { … }
bool TypeStreamMerger::remapIndexFallback(TypeIndex &Idx,
ArrayRef<TypeIndex> Map) { … }
Error TypeStreamMerger::mergeTypeRecords(MergingTypeTableBuilder &Dest,
const CVTypeArray &Types) { … }
Error TypeStreamMerger::mergeIdRecords(MergingTypeTableBuilder &Dest,
ArrayRef<TypeIndex> TypeSourceToDest,
const CVTypeArray &Ids) { … }
Error TypeStreamMerger::mergeTypesAndIds(
MergingTypeTableBuilder &DestIds, MergingTypeTableBuilder &DestTypes,
const CVTypeArray &IdsAndTypes, std::optional<PCHMergerInfo> &PCHInfo) { … }
Error TypeStreamMerger::mergeTypeRecords(
GlobalTypeTableBuilder &Dest, const CVTypeArray &Types,
ArrayRef<GloballyHashedType> Hashes,
std::optional<PCHMergerInfo> &PCHInfo) { … }
Error TypeStreamMerger::mergeIdRecords(GlobalTypeTableBuilder &Dest,
ArrayRef<TypeIndex> TypeSourceToDest,
const CVTypeArray &Ids,
ArrayRef<GloballyHashedType> Hashes) { … }
Error TypeStreamMerger::mergeTypesAndIds(
GlobalTypeTableBuilder &DestIds, GlobalTypeTableBuilder &DestTypes,
const CVTypeArray &IdsAndTypes, ArrayRef<GloballyHashedType> Hashes,
std::optional<PCHMergerInfo> &PCHInfo) { … }
Error TypeStreamMerger::doit(const CVTypeArray &Types) { … }
Error TypeStreamMerger::remapAllTypes(const CVTypeArray &Types) { … }
Error TypeStreamMerger::remapType(const CVType &Type) { … }
ArrayRef<uint8_t>
TypeStreamMerger::remapIndices(const CVType &OriginalType,
MutableArrayRef<uint8_t> Storage) { … }
Error llvm::codeview::mergeTypeRecords(MergingTypeTableBuilder &Dest,
SmallVectorImpl<TypeIndex> &SourceToDest,
const CVTypeArray &Types) { … }
Error llvm::codeview::mergeIdRecords(MergingTypeTableBuilder &Dest,
ArrayRef<TypeIndex> TypeSourceToDest,
SmallVectorImpl<TypeIndex> &SourceToDest,
const CVTypeArray &Ids) { … }
Error llvm::codeview::mergeTypeAndIdRecords(
MergingTypeTableBuilder &DestIds, MergingTypeTableBuilder &DestTypes,
SmallVectorImpl<TypeIndex> &SourceToDest, const CVTypeArray &IdsAndTypes,
std::optional<PCHMergerInfo> &PCHInfo) { … }
Error llvm::codeview::mergeTypeAndIdRecords(
GlobalTypeTableBuilder &DestIds, GlobalTypeTableBuilder &DestTypes,
SmallVectorImpl<TypeIndex> &SourceToDest, const CVTypeArray &IdsAndTypes,
ArrayRef<GloballyHashedType> Hashes,
std::optional<PCHMergerInfo> &PCHInfo) { … }
Error llvm::codeview::mergeTypeRecords(GlobalTypeTableBuilder &Dest,
SmallVectorImpl<TypeIndex> &SourceToDest,
const CVTypeArray &Types,
ArrayRef<GloballyHashedType> Hashes,
std::optional<PCHMergerInfo> &PCHInfo) { … }
Error llvm::codeview::mergeIdRecords(GlobalTypeTableBuilder &Dest,
ArrayRef<TypeIndex> Types,
SmallVectorImpl<TypeIndex> &SourceToDest,
const CVTypeArray &Ids,
ArrayRef<GloballyHashedType> Hashes) { … }
Expected<bool> TypeStreamMerger::shouldRemapType(const CVType &Type) { … }