Path: blob/main/contrib/llvm-project/llvm/tools/llvm-pdbutil/PrettyExternalSymbolDumper.cpp
35260 views
//===- PrettyExternalSymbolDumper.cpp -------------------------- *- 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 "PrettyExternalSymbolDumper.h"910#include "llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h"11#include "llvm/DebugInfo/PDB/Native/LinePrinter.h"12#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"13#include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"14#include "llvm/Support/Format.h"1516using namespace llvm;17using namespace llvm::pdb;1819ExternalSymbolDumper::ExternalSymbolDumper(LinePrinter &P)20: PDBSymDumper(true), Printer(P) {}2122void ExternalSymbolDumper::start(const PDBSymbolExe &Symbol) {23if (auto Vars = Symbol.findAllChildren<PDBSymbolPublicSymbol>()) {24while (auto Var = Vars->getNext())25Var->dump(*this);26}27}2829void ExternalSymbolDumper::dump(const PDBSymbolPublicSymbol &Symbol) {30std::string LinkageName = Symbol.getName();31if (Printer.IsSymbolExcluded(LinkageName))32return;3334Printer.NewLine();35uint64_t Addr = Symbol.getVirtualAddress();3637Printer << "public [";38WithColor(Printer, PDB_ColorItem::Address).get() << format_hex(Addr, 10);39Printer << "] ";40WithColor(Printer, PDB_ColorItem::Identifier).get() << LinkageName;41}424344