Path: blob/main/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/NativePublicSymbol.cpp
35293 views
//===- NativePublicSymbol.cpp - info about public symbols -------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "llvm/DebugInfo/PDB/Native/NativePublicSymbol.h"910#include "llvm/DebugInfo/CodeView/SymbolRecord.h"11#include "llvm/DebugInfo/PDB/Native/NativeSession.h"1213using namespace llvm;14using namespace llvm::codeview;15using namespace llvm::pdb;1617NativePublicSymbol::NativePublicSymbol(NativeSession &Session, SymIndexId Id,18const codeview::PublicSym32 &Sym)19: NativeRawSymbol(Session, PDB_SymType::PublicSymbol, Id), Sym(Sym) {}2021NativePublicSymbol::~NativePublicSymbol() = default;2223void NativePublicSymbol::dump(raw_ostream &OS, int Indent,24PdbSymbolIdField ShowIdFields,25PdbSymbolIdField RecurseIdFields) const {26NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);27dumpSymbolField(OS, "name", getName(), Indent);28dumpSymbolField(OS, "offset", getAddressOffset(), Indent);29dumpSymbolField(OS, "section", getAddressSection(), Indent);30}3132uint32_t NativePublicSymbol::getAddressOffset() const { return Sym.Offset; }3334uint32_t NativePublicSymbol::getAddressSection() const { return Sym.Segment; }3536std::string NativePublicSymbol::getName() const {37return std::string(Sym.Name);38}3940uint32_t NativePublicSymbol::getRelativeVirtualAddress() const {41return Session.getRVAFromSectOffset(Sym.Segment, Sym.Offset);42}4344uint64_t NativePublicSymbol::getVirtualAddress() const {45return Session.getVAFromSectOffset(Sym.Segment, Sym.Offset);46}474849