llvm/llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp

//===- DbiStreamBuilder.cpp - PDB Dbi Stream Creation -----------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// The data structures defined in this file are based on the reference
// implementation which is available at
// https://github.com/Microsoft/microsoft-pdb/blob/master/PDB/dbi/gsi.cpp
//
//===----------------------------------------------------------------------===//

#include "llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h"
#include "llvm/DebugInfo/CodeView/RecordName.h"
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
#include "llvm/DebugInfo/CodeView/SymbolSerializer.h"
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
#include "llvm/DebugInfo/MSF/MSFCommon.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"
#include "llvm/DebugInfo/PDB/Native/Hash.h"
#include "llvm/DebugInfo/PDB/Native/RawTypes.h"
#include "llvm/Support/BinaryItemStream.h"
#include "llvm/Support/BinaryStreamWriter.h"
#include "llvm/Support/Parallel.h"
#include "llvm/Support/TimeProfiler.h"
#include "llvm/Support/xxhash.h"
#include <algorithm>
#include <vector>

usingnamespacellvm;
usingnamespacellvm::msf;
usingnamespacellvm::pdb;
usingnamespacellvm::codeview;

// Helper class for building the public and global PDB hash table buckets.
struct llvm::pdb::GSIHashStreamBuilder {};

// DenseMapInfo implementation for deduplicating symbol records.
struct llvm::pdb::SymbolDenseMapInfo {};

namespace {
LLVM_PACKED_START
struct PublicSym32Layout {};
LLVM_PACKED_END
} // namespace

// Calculate how much memory this public needs when serialized.
static uint32_t sizeOfPublic(const BulkPublic &Pub) {}

static CVSymbol serializePublic(uint8_t *Mem, const BulkPublic &Pub) {}

uint32_t GSIHashStreamBuilder::calculateSerializedLength() const {}

Error GSIHashStreamBuilder::commit(BinaryStreamWriter &Writer) {}

static bool isAsciiString(StringRef S) {}

// See `caseInsensitiveComparePchPchCchCch` in gsi.cpp
static int gsiRecordCmp(StringRef S1, StringRef S2) {}

void GSIStreamBuilder::finalizePublicBuckets() {}

void GSIStreamBuilder::finalizeGlobalBuckets(uint32_t RecordZeroOffset) {}

void GSIHashStreamBuilder::finalizeBuckets(
    uint32_t RecordZeroOffset, MutableArrayRef<BulkPublic> Records) {}

GSIStreamBuilder::GSIStreamBuilder(msf::MSFBuilder &Msf)
    :{}

GSIStreamBuilder::~GSIStreamBuilder() = default;

uint32_t GSIStreamBuilder::calculatePublicsHashStreamSize() const {}

uint32_t GSIStreamBuilder::calculateGlobalsHashStreamSize() const {}

Error GSIStreamBuilder::finalizeMsfLayout() {}

void GSIStreamBuilder::addPublicSymbols(std::vector<BulkPublic> &&PublicsIn) {}

void GSIStreamBuilder::addGlobalSymbol(const ProcRefSym &Sym) {}

void GSIStreamBuilder::addGlobalSymbol(const DataSym &Sym) {}

void GSIStreamBuilder::addGlobalSymbol(const ConstantSym &Sym) {}

template <typename T>
void GSIStreamBuilder::serializeAndAddGlobal(const T &Symbol) {}

void GSIStreamBuilder::addGlobalSymbol(const codeview::CVSymbol &Symbol) {}

// Serialize each public and write it.
static Error writePublics(BinaryStreamWriter &Writer,
                          ArrayRef<BulkPublic> Publics) {}

static Error writeRecords(BinaryStreamWriter &Writer,
                          ArrayRef<CVSymbol> Records) {}

Error GSIStreamBuilder::commitSymbolRecordStream(
    WritableBinaryStreamRef Stream) {}

static std::vector<support::ulittle32_t>
computeAddrMap(ArrayRef<BulkPublic> Publics) {}

Error GSIStreamBuilder::commitPublicsHashStream(
    WritableBinaryStreamRef Stream) {}

Error GSIStreamBuilder::commitGlobalsHashStream(
    WritableBinaryStreamRef Stream) {}

Error GSIStreamBuilder::commit(const msf::MSFLayout &Layout,
                               WritableBinaryStreamRef Buffer) {}