diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp')
-rw-r--r-- | contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp | 248 |
1 files changed, 124 insertions, 124 deletions
diff --git a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp index e5f1dcaf80..1d262b506c 100644 --- a/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp +++ b/contrib/libs/llvm12/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp @@ -1,124 +1,124 @@ -//===- NativeSymbolEnumerator.cpp - info about enumerators ------*- 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 -// -//===----------------------------------------------------------------------===// - -#include "llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h" - -#include "llvm/DebugInfo/CodeView/SymbolRecord.h" -#include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h" -#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h" - -using namespace llvm; -using namespace llvm::codeview; -using namespace llvm::pdb; - -NativeSymbolEnumerator::NativeSymbolEnumerator( - NativeSession &Session, SymIndexId Id, const NativeTypeEnum &Parent, - codeview::EnumeratorRecord Record) - : NativeRawSymbol(Session, PDB_SymType::Data, Id), Parent(Parent), - Record(std::move(Record)) {} - -NativeSymbolEnumerator::~NativeSymbolEnumerator() {} - -void NativeSymbolEnumerator::dump(raw_ostream &OS, int Indent, - PdbSymbolIdField ShowIdFields, - PdbSymbolIdField RecurseIdFields) const { - NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields); - dumpSymbolIdField(OS, "classParentId", getClassParentId(), Indent, Session, - PdbSymbolIdField::ClassParent, ShowIdFields, - RecurseIdFields); - dumpSymbolIdField(OS, "lexicalParentId", getLexicalParentId(), Indent, - Session, PdbSymbolIdField::LexicalParent, ShowIdFields, - RecurseIdFields); - dumpSymbolField(OS, "name", getName(), Indent); - dumpSymbolIdField(OS, "typeId", getTypeId(), Indent, Session, - PdbSymbolIdField::Type, ShowIdFields, RecurseIdFields); - dumpSymbolField(OS, "dataKind", getDataKind(), Indent); - dumpSymbolField(OS, "locationType", getLocationType(), Indent); - dumpSymbolField(OS, "constType", isConstType(), Indent); - dumpSymbolField(OS, "unalignedType", isUnalignedType(), Indent); - dumpSymbolField(OS, "volatileType", isVolatileType(), Indent); - dumpSymbolField(OS, "value", getValue(), Indent); -} - -SymIndexId NativeSymbolEnumerator::getClassParentId() const { - return Parent.getSymIndexId(); -} - -SymIndexId NativeSymbolEnumerator::getLexicalParentId() const { return 0; } - -std::string NativeSymbolEnumerator::getName() const { - return std::string(Record.Name); -} - -SymIndexId NativeSymbolEnumerator::getTypeId() const { - return Parent.getTypeId(); -} - -PDB_DataKind NativeSymbolEnumerator::getDataKind() const { - return PDB_DataKind::Constant; -} - -PDB_LocType NativeSymbolEnumerator::getLocationType() const { - return PDB_LocType::Constant; -} - -bool NativeSymbolEnumerator::isConstType() const { return false; } - -bool NativeSymbolEnumerator::isVolatileType() const { return false; } - -bool NativeSymbolEnumerator::isUnalignedType() const { return false; } - -Variant NativeSymbolEnumerator::getValue() const { - const NativeTypeBuiltin &BT = Parent.getUnderlyingBuiltinType(); - - switch (BT.getBuiltinType()) { - case PDB_BuiltinType::Int: - case PDB_BuiltinType::Long: - case PDB_BuiltinType::Char: { - assert(Record.Value.isSignedIntN(BT.getLength() * 8)); - int64_t N = Record.Value.getSExtValue(); - switch (BT.getLength()) { - case 1: - return Variant{static_cast<int8_t>(N)}; - case 2: - return Variant{static_cast<int16_t>(N)}; - case 4: - return Variant{static_cast<int32_t>(N)}; - case 8: - return Variant{static_cast<int64_t>(N)}; - } - break; - } - case PDB_BuiltinType::UInt: - case PDB_BuiltinType::ULong: { - assert(Record.Value.isIntN(BT.getLength() * 8)); - uint64_t U = Record.Value.getZExtValue(); - switch (BT.getLength()) { - case 1: - return Variant{static_cast<uint8_t>(U)}; - case 2: - return Variant{static_cast<uint16_t>(U)}; - case 4: - return Variant{static_cast<uint32_t>(U)}; - case 8: - return Variant{static_cast<uint64_t>(U)}; - } - break; - } - case PDB_BuiltinType::Bool: { - assert(Record.Value.isIntN(BT.getLength() * 8)); - uint64_t U = Record.Value.getZExtValue(); - return Variant{static_cast<bool>(U)}; - } - default: - assert(false && "Invalid enumeration type"); - break; - } - - return Variant{Record.Value.getSExtValue()}; -} +//===- NativeSymbolEnumerator.cpp - info about enumerators ------*- 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 +// +//===----------------------------------------------------------------------===// + +#include "llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h" + +#include "llvm/DebugInfo/CodeView/SymbolRecord.h" +#include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h" +#include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h" + +using namespace llvm; +using namespace llvm::codeview; +using namespace llvm::pdb; + +NativeSymbolEnumerator::NativeSymbolEnumerator( + NativeSession &Session, SymIndexId Id, const NativeTypeEnum &Parent, + codeview::EnumeratorRecord Record) + : NativeRawSymbol(Session, PDB_SymType::Data, Id), Parent(Parent), + Record(std::move(Record)) {} + +NativeSymbolEnumerator::~NativeSymbolEnumerator() {} + +void NativeSymbolEnumerator::dump(raw_ostream &OS, int Indent, + PdbSymbolIdField ShowIdFields, + PdbSymbolIdField RecurseIdFields) const { + NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields); + dumpSymbolIdField(OS, "classParentId", getClassParentId(), Indent, Session, + PdbSymbolIdField::ClassParent, ShowIdFields, + RecurseIdFields); + dumpSymbolIdField(OS, "lexicalParentId", getLexicalParentId(), Indent, + Session, PdbSymbolIdField::LexicalParent, ShowIdFields, + RecurseIdFields); + dumpSymbolField(OS, "name", getName(), Indent); + dumpSymbolIdField(OS, "typeId", getTypeId(), Indent, Session, + PdbSymbolIdField::Type, ShowIdFields, RecurseIdFields); + dumpSymbolField(OS, "dataKind", getDataKind(), Indent); + dumpSymbolField(OS, "locationType", getLocationType(), Indent); + dumpSymbolField(OS, "constType", isConstType(), Indent); + dumpSymbolField(OS, "unalignedType", isUnalignedType(), Indent); + dumpSymbolField(OS, "volatileType", isVolatileType(), Indent); + dumpSymbolField(OS, "value", getValue(), Indent); +} + +SymIndexId NativeSymbolEnumerator::getClassParentId() const { + return Parent.getSymIndexId(); +} + +SymIndexId NativeSymbolEnumerator::getLexicalParentId() const { return 0; } + +std::string NativeSymbolEnumerator::getName() const { + return std::string(Record.Name); +} + +SymIndexId NativeSymbolEnumerator::getTypeId() const { + return Parent.getTypeId(); +} + +PDB_DataKind NativeSymbolEnumerator::getDataKind() const { + return PDB_DataKind::Constant; +} + +PDB_LocType NativeSymbolEnumerator::getLocationType() const { + return PDB_LocType::Constant; +} + +bool NativeSymbolEnumerator::isConstType() const { return false; } + +bool NativeSymbolEnumerator::isVolatileType() const { return false; } + +bool NativeSymbolEnumerator::isUnalignedType() const { return false; } + +Variant NativeSymbolEnumerator::getValue() const { + const NativeTypeBuiltin &BT = Parent.getUnderlyingBuiltinType(); + + switch (BT.getBuiltinType()) { + case PDB_BuiltinType::Int: + case PDB_BuiltinType::Long: + case PDB_BuiltinType::Char: { + assert(Record.Value.isSignedIntN(BT.getLength() * 8)); + int64_t N = Record.Value.getSExtValue(); + switch (BT.getLength()) { + case 1: + return Variant{static_cast<int8_t>(N)}; + case 2: + return Variant{static_cast<int16_t>(N)}; + case 4: + return Variant{static_cast<int32_t>(N)}; + case 8: + return Variant{static_cast<int64_t>(N)}; + } + break; + } + case PDB_BuiltinType::UInt: + case PDB_BuiltinType::ULong: { + assert(Record.Value.isIntN(BT.getLength() * 8)); + uint64_t U = Record.Value.getZExtValue(); + switch (BT.getLength()) { + case 1: + return Variant{static_cast<uint8_t>(U)}; + case 2: + return Variant{static_cast<uint16_t>(U)}; + case 4: + return Variant{static_cast<uint32_t>(U)}; + case 8: + return Variant{static_cast<uint64_t>(U)}; + } + break; + } + case PDB_BuiltinType::Bool: { + assert(Record.Value.isIntN(BT.getLength() * 8)); + uint64_t U = Record.Value.getZExtValue(); + return Variant{static_cast<bool>(U)}; + } + default: + assert(false && "Invalid enumeration type"); + break; + } + + return Variant{Record.Value.getSExtValue()}; +} |