mirror of
				https://github.com/c64scene-ar/llvm-6502.git
				synced 2025-11-03 14:21:30 +00:00 
			
		
		
		
	Frequently you only want to iterate over children of a specific type (e.g. functions). Previously you would get back a generic interface that allowed iteration over the base symbol type, which you would have to dyn_cast<> each one of. With this patch, we allow the user to specify the concrete type as a template parameter, and it will return an iterator which returns instances of the concrete type directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228960 91177308-0d34-0410-b5e6-96231b3b80d8
		
			
				
	
	
		
			45 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
//===- PDBSymbolThunk.cpp - -------------------------------------*- C++ -*-===//
 | 
						|
//
 | 
						|
//                     The LLVM Compiler Infrastructure
 | 
						|
//
 | 
						|
// This file is distributed under the University of Illinois Open Source
 | 
						|
// License. See LICENSE.TXT for details.
 | 
						|
//
 | 
						|
//===----------------------------------------------------------------------===//
 | 
						|
 | 
						|
#include <utility>
 | 
						|
 | 
						|
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
 | 
						|
#include "llvm/DebugInfo/PDB/PDBSymbolThunk.h"
 | 
						|
 | 
						|
#include "llvm/Support/Format.h"
 | 
						|
 | 
						|
using namespace llvm;
 | 
						|
 | 
						|
PDBSymbolThunk::PDBSymbolThunk(const IPDBSession &PDBSession,
 | 
						|
                               std::unique_ptr<IPDBRawSymbol> Symbol)
 | 
						|
    : PDBSymbol(PDBSession, std::move(Symbol)) {}
 | 
						|
 | 
						|
void PDBSymbolThunk::dump(raw_ostream &OS, int Indent,
 | 
						|
                          PDB_DumpLevel Level) const {
 | 
						|
  if (Level == PDB_DumpLevel::Compact) {
 | 
						|
    OS.indent(Indent);
 | 
						|
    PDB_ThunkOrdinal Ordinal = getThunkOrdinal();
 | 
						|
    uint32_t RVA = getRelativeVirtualAddress();
 | 
						|
    if (Ordinal == PDB_ThunkOrdinal::TrampIncremental) {
 | 
						|
      OS << format_hex(RVA, 10);
 | 
						|
    } else {
 | 
						|
      OS << "[" << format_hex(RVA, 10);
 | 
						|
      OS << " - " << format_hex(RVA + getLength(), 10) << "]";
 | 
						|
    }
 | 
						|
    OS << " thunk(" << Ordinal << ")";
 | 
						|
    if (Ordinal == PDB_ThunkOrdinal::TrampIncremental)
 | 
						|
      OS << " -> " << format_hex(getTargetRelativeVirtualAddress(), 10);
 | 
						|
    OS << " ";
 | 
						|
    std::string Name = getName();
 | 
						|
    if (!Name.empty())
 | 
						|
      OS << Name;
 | 
						|
    OS << "\n";
 | 
						|
  }
 | 
						|
}
 |