CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
161 lines
4.4 KiB
C++
161 lines
4.4 KiB
C++
//===-- PdbSymUid.cpp -----------------------------------------------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "PdbSymUid.h"
|
|
|
|
using namespace lldb_private;
|
|
using namespace lldb_private::npdb;
|
|
using namespace llvm::codeview;
|
|
|
|
namespace {
|
|
struct GenericIdRepr {
|
|
uint64_t tag : 4;
|
|
uint64_t data : 60;
|
|
};
|
|
|
|
struct CompilandIdRepr {
|
|
uint64_t tag : 4;
|
|
uint64_t modi : 16;
|
|
uint64_t unused : 44;
|
|
};
|
|
|
|
struct CompilandSymIdRepr {
|
|
uint64_t tag : 4;
|
|
uint64_t modi : 16;
|
|
uint64_t offset : 32;
|
|
uint64_t unused : 12;
|
|
};
|
|
|
|
struct GlobalSymIdRepr {
|
|
uint64_t tag : 4;
|
|
uint64_t offset : 32;
|
|
uint64_t pub : 1;
|
|
uint64_t unused : 27;
|
|
};
|
|
|
|
struct TypeSymIdRepr {
|
|
uint64_t tag : 4;
|
|
uint64_t index : 32;
|
|
uint64_t ipi : 1;
|
|
uint64_t unused : 27;
|
|
};
|
|
|
|
struct FieldListMemberIdRepr {
|
|
uint64_t tag : 4;
|
|
uint64_t index : 32;
|
|
uint64_t offset : 16;
|
|
uint64_t unused : 12;
|
|
};
|
|
|
|
static_assert(sizeof(CompilandIdRepr) == 8, "Invalid structure size!");
|
|
static_assert(sizeof(CompilandSymIdRepr) == 8, "Invalid structure size!");
|
|
static_assert(sizeof(GlobalSymIdRepr) == 8, "Invalid structure size!");
|
|
static_assert(sizeof(TypeSymIdRepr) == 8, "Invalid structure size!");
|
|
static_assert(sizeof(FieldListMemberIdRepr) == 8, "Invalid structure size!");
|
|
} // namespace
|
|
|
|
template <typename OutT, typename InT> static OutT repr_cast(const InT &value) {
|
|
OutT result;
|
|
::memcpy(&result, &value, sizeof(value));
|
|
return result;
|
|
}
|
|
|
|
PdbSymUid::PdbSymUid(const PdbCompilandId &cid) {
|
|
CompilandIdRepr repr;
|
|
::memset(&repr, 0, sizeof(repr));
|
|
repr.modi = cid.modi;
|
|
repr.tag = static_cast<uint64_t>(PdbSymUidKind::Compiland);
|
|
m_repr = repr_cast<uint64_t>(repr);
|
|
}
|
|
|
|
PdbSymUid::PdbSymUid(const PdbCompilandSymId &csid) {
|
|
CompilandSymIdRepr repr;
|
|
::memset(&repr, 0, sizeof(repr));
|
|
repr.modi = csid.modi;
|
|
repr.offset = csid.offset;
|
|
repr.tag = static_cast<uint64_t>(PdbSymUidKind::CompilandSym);
|
|
m_repr = repr_cast<uint64_t>(repr);
|
|
}
|
|
|
|
PdbSymUid::PdbSymUid(const PdbGlobalSymId &gsid) {
|
|
GlobalSymIdRepr repr;
|
|
::memset(&repr, 0, sizeof(repr));
|
|
repr.pub = gsid.is_public;
|
|
repr.offset = gsid.offset;
|
|
repr.tag = static_cast<uint64_t>(PdbSymUidKind::GlobalSym);
|
|
m_repr = repr_cast<uint64_t>(repr);
|
|
}
|
|
|
|
PdbSymUid::PdbSymUid(const PdbTypeSymId &tsid) {
|
|
TypeSymIdRepr repr;
|
|
::memset(&repr, 0, sizeof(repr));
|
|
repr.index = tsid.index.getIndex();
|
|
repr.ipi = tsid.is_ipi;
|
|
repr.tag = static_cast<uint64_t>(PdbSymUidKind::Type);
|
|
m_repr = repr_cast<uint64_t>(repr);
|
|
}
|
|
|
|
PdbSymUid::PdbSymUid(const PdbFieldListMemberId &flmid) {
|
|
FieldListMemberIdRepr repr;
|
|
::memset(&repr, 0, sizeof(repr));
|
|
repr.index = flmid.index.getIndex();
|
|
repr.offset = flmid.offset;
|
|
repr.tag = static_cast<uint64_t>(PdbSymUidKind::FieldListMember);
|
|
m_repr = repr_cast<uint64_t>(repr);
|
|
}
|
|
|
|
PdbSymUidKind PdbSymUid::kind() const {
|
|
GenericIdRepr generic = repr_cast<GenericIdRepr>(m_repr);
|
|
return static_cast<PdbSymUidKind>(generic.tag);
|
|
}
|
|
|
|
PdbCompilandId PdbSymUid::asCompiland() const {
|
|
assert(kind() == PdbSymUidKind::Compiland);
|
|
auto repr = repr_cast<CompilandIdRepr>(m_repr);
|
|
PdbCompilandId result;
|
|
result.modi = repr.modi;
|
|
return result;
|
|
}
|
|
|
|
PdbCompilandSymId PdbSymUid::asCompilandSym() const {
|
|
assert(kind() == PdbSymUidKind::CompilandSym);
|
|
auto repr = repr_cast<CompilandSymIdRepr>(m_repr);
|
|
PdbCompilandSymId result;
|
|
result.modi = repr.modi;
|
|
result.offset = repr.offset;
|
|
return result;
|
|
}
|
|
|
|
PdbGlobalSymId PdbSymUid::asGlobalSym() const {
|
|
assert(kind() == PdbSymUidKind::GlobalSym ||
|
|
kind() == PdbSymUidKind::PublicSym);
|
|
auto repr = repr_cast<GlobalSymIdRepr>(m_repr);
|
|
PdbGlobalSymId result;
|
|
result.is_public = repr.pub;
|
|
result.offset = repr.offset;
|
|
return result;
|
|
}
|
|
|
|
PdbTypeSymId PdbSymUid::asTypeSym() const {
|
|
assert(kind() == PdbSymUidKind::Type);
|
|
auto repr = repr_cast<TypeSymIdRepr>(m_repr);
|
|
PdbTypeSymId result;
|
|
result.index.setIndex(repr.index);
|
|
result.is_ipi = repr.ipi;
|
|
return result;
|
|
}
|
|
|
|
PdbFieldListMemberId PdbSymUid::asFieldListMember() const {
|
|
assert(kind() == PdbSymUidKind::FieldListMember);
|
|
auto repr = repr_cast<FieldListMemberIdRepr>(m_repr);
|
|
PdbFieldListMemberId result;
|
|
result.index.setIndex(repr.index);
|
|
result.offset = repr.offset;
|
|
return result;
|
|
}
|