LLVM 23.0.0git
llvm::CodeViewContext Class Reference

Holds state from .cv_file and .cv_loc directives for later emission. More...

#include "llvm/MC/MCCodeView.h"

Public Member Functions

 CodeViewContext (MCContext *MCCtx)
CodeViewContextoperator= (const CodeViewContext &other)=delete
 CodeViewContext (const CodeViewContext &other)=delete
LLVM_ABI void finish ()
LLVM_ABI bool isValidFileNumber (unsigned FileNumber) const
 This is a valid number for use with .cv_loc if we've already seen a .cv_file for it.
LLVM_ABI bool addFile (MCStreamer &OS, unsigned FileNumber, StringRef Filename, ArrayRef< uint8_t > ChecksumBytes, uint8_t ChecksumKind)
LLVM_ABI bool recordFunctionId (unsigned FuncId)
 Records the function id of a normal function.
LLVM_ABI bool recordInlinedCallSiteId (unsigned FuncId, unsigned IAFunc, unsigned IAFile, unsigned IALine, unsigned IACol)
 Records the function id of an inlined call site.
LLVM_ABI MCCVFunctionInfogetCVFunctionInfo (unsigned FuncId)
 Retreive the function info if this is a valid function id, or nullptr.
LLVM_ABI void recordCVLoc (MCContext &Ctx, const MCSymbol *Label, unsigned FunctionId, unsigned FileNo, unsigned Line, unsigned Column, bool PrologueEnd, bool IsStmt)
 Saves the information from the currently parsed .cv_loc directive and sets CVLocSeen.
LLVM_ABI void addLineEntry (const MCCVLoc &LineEntry)
 Add a line entry.
LLVM_ABI std::vector< MCCVLocgetFunctionLineEntries (unsigned FuncId)
LLVM_ABI std::pair< size_t, size_t > getLineExtent (unsigned FuncId)
LLVM_ABI std::pair< size_t, size_t > getLineExtentIncludingInlinees (unsigned FuncId)
LLVM_ABI ArrayRef< MCCVLocgetLinesForExtent (size_t L, size_t R)
LLVM_ABI void emitLineTableForFunction (MCObjectStreamer &OS, unsigned FuncId, const MCSymbol *FuncBegin, const MCSymbol *FuncEnd)
 Emits a line table substream.
LLVM_ABI void emitInlineLineTableForFunction (MCObjectStreamer &OS, unsigned PrimaryFunctionId, unsigned SourceFileId, unsigned SourceLineNum, const MCSymbol *FnStartSym, const MCSymbol *FnEndSym)
LLVM_ABI void encodeInlineLineTable (const MCAssembler &Asm, MCCVInlineLineTableFragment &F)
 Encodes the binary annotations once we have a layout.
LLVM_ABI void emitDefRange (MCObjectStreamer &OS, ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges, StringRef FixedSizePortion)
LLVM_ABI void encodeDefRange (const MCAssembler &Asm, MCCVDefRangeFragment &F)
LLVM_ABI void emitStringTable (MCObjectStreamer &OS)
 Emits the string table substream.
LLVM_ABI void emitFileChecksums (MCObjectStreamer &OS)
 Emits the file checksum substream.
LLVM_ABI void emitFileChecksumOffset (MCObjectStreamer &OS, unsigned FileNo)
 Emits the offset into the checksum table of the given file number.
LLVM_ABI std::pair< StringRef, unsignedaddToStringTable (StringRef S)
 Add something to the string table.

Detailed Description

Holds state from .cv_file and .cv_loc directives for later emission.

Definition at line 144 of file MCCodeView.h.

Constructor & Destructor Documentation

◆ CodeViewContext() [1/2]

llvm::CodeViewContext::CodeViewContext ( MCContext * MCCtx)
inline

Definition at line 146 of file MCCodeView.h.

Referenced by CodeViewContext(), and operator=().

◆ CodeViewContext() [2/2]

llvm::CodeViewContext::CodeViewContext ( const CodeViewContext & other)
delete

References CodeViewContext(), F, Filename, and LLVM_ABI.

Member Function Documentation

◆ addFile()

bool CodeViewContext::addFile ( MCStreamer & OS,
unsigned FileNumber,
StringRef Filename,
ArrayRef< uint8_t > ChecksumBytes,
uint8_t ChecksumKind )

◆ addLineEntry()

void CodeViewContext::addLineEntry ( const MCCVLoc & LineEntry)

Add a line entry.

Definition at line 254 of file MCCodeView.cpp.

References llvm::MCCVLoc::getFunctionId(), I, and llvm::Offset.

Referenced by recordCVLoc().

◆ addToStringTable()

std::pair< StringRef, unsigned > CodeViewContext::addToStringTable ( StringRef S)

Add something to the string table.

Returns the final string as well as offset into the string table.

Definition at line 136 of file MCCodeView.cpp.

Referenced by addFile().

◆ emitDefRange()

void CodeViewContext::emitDefRange ( MCObjectStreamer & OS,
ArrayRef< std::pair< const MCSymbol *, const MCSymbol * > > Ranges,
StringRef FixedSizePortion )

◆ emitFileChecksumOffset()

void CodeViewContext::emitFileChecksumOffset ( MCObjectStreamer & OS,
unsigned FileNo )

◆ emitFileChecksums()

◆ emitInlineLineTableForFunction()

void CodeViewContext::emitInlineLineTableForFunction ( MCObjectStreamer & OS,
unsigned PrimaryFunctionId,
unsigned SourceFileId,
unsigned SourceLineNum,
const MCSymbol * FnStartSym,
const MCSymbol * FnEndSym )

◆ emitLineTableForFunction()

◆ emitStringTable()

◆ encodeDefRange()

◆ encodeInlineLineTable()

◆ finish()

void CodeViewContext::finish ( )

Definition at line 28 of file MCCodeView.cpp.

References assert(), and llvm::MCFragment::FT_Data.

Referenced by llvm::MCWinCOFFStreamer::finishImpl().

◆ getCVFunctionInfo()

MCCVFunctionInfo * CodeViewContext::getCVFunctionInfo ( unsigned FuncId)

Retreive the function info if this is a valid function id, or nullptr.

Definition at line 76 of file MCCodeView.cpp.

Referenced by llvm::MCStreamer::checkCVLocSection(), encodeInlineLineTable(), getFunctionLineEntries(), getLineExtentIncludingInlinees(), and recordInlinedCallSiteId().

◆ getFunctionLineEntries()

std::vector< MCCVLoc > CodeViewContext::getFunctionLineEntries ( unsigned FuncId)

◆ getLineExtent()

std::pair< size_t, size_t > CodeViewContext::getLineExtent ( unsigned FuncId)

Definition at line 302 of file MCCodeView.cpp.

References I.

Referenced by getLineExtentIncludingInlinees().

◆ getLineExtentIncludingInlinees()

std::pair< size_t, size_t > CodeViewContext::getLineExtentIncludingInlinees ( unsigned FuncId)

◆ getLinesForExtent()

ArrayRef< MCCVLoc > CodeViewContext::getLinesForExtent ( size_t L,
size_t R )

Definition at line 330 of file MCCodeView.cpp.

References llvm::ArrayRef().

Referenced by encodeInlineLineTable().

◆ isValidFileNumber()

bool CodeViewContext::isValidFileNumber ( unsigned FileNumber) const

This is a valid number for use with .cv_loc if we've already seen a .cv_file for it.

Definition at line 37 of file MCCodeView.cpp.

◆ operator=()

CodeViewContext & llvm::CodeViewContext::operator= ( const CodeViewContext & other)
delete

References CodeViewContext().

◆ recordCVLoc()

void CodeViewContext::recordCVLoc ( MCContext & Ctx,
const MCSymbol * Label,
unsigned FunctionId,
unsigned FileNo,
unsigned Line,
unsigned Column,
bool PrologueEnd,
bool IsStmt )

Saves the information from the currently parsed .cv_loc directive and sets CVLocSeen.

When the next instruction is assembled an entry in the line number table with this information and the address of the instruction will be created.

Definition at line 128 of file MCCodeView.cpp.

References addLineEntry().

Referenced by llvm::MCObjectStreamer::emitCVLocDirective().

◆ recordFunctionId()

bool CodeViewContext::recordFunctionId ( unsigned FuncId)

Records the function id of a normal function.

Returns false if the function id has already been used, and true otherwise.

Definition at line 84 of file MCCodeView.cpp.

References llvm::MCCVFunctionInfo::FunctionSentinel.

Referenced by llvm::MCStreamer::emitCVFuncIdDirective().

◆ recordInlinedCallSiteId()

bool CodeViewContext::recordInlinedCallSiteId ( unsigned FuncId,
unsigned IAFunc,
unsigned IAFile,
unsigned IALine,
unsigned IACol )

Records the function id of an inlined call site.

Records the "inlined at" location info of the call site, including what function or inlined call site it was inlined into. Returns false if the function id has already been used, and true otherwise.

Definition at line 97 of file MCCodeView.cpp.

References llvm::MCCVFunctionInfo::LineInfo::Col, llvm::MCCVFunctionInfo::LineInfo::File, getCVFunctionInfo(), llvm::MCCVFunctionInfo::LineInfo::Line, and llvm::MCCVFunctionInfo::ParentFuncIdPlusOne.

Referenced by llvm::MCStreamer::emitCVInlineSiteIdDirective().


The documentation for this class was generated from the following files: