LLVM 20.0.0git
Public Types | Public Member Functions | List of all members
llvm::NonRelocatableStringpool Class Reference

A string table that doesn't need relocations. More...

#include "llvm/CodeGen/NonRelocatableStringpool.h"

Public Types

using MapTy = StringMap< DwarfStringPoolEntry, BumpPtrAllocator >
 Entries are stored into the StringMap and simply linked together through the second element of this pair in order to keep track of insertion order.
 

Public Member Functions

 NonRelocatableStringpool (bool PutEmptyString=false)
 
DwarfStringPoolEntryRef getEntry (StringRef S)
 
uint64_t getStringOffset (StringRef S)
 Get the offset of string S in the string table.
 
StringRef internString (StringRef S)
 Get permanent storage for S (but do not necessarily emit S in the output section).
 
uint64_t getSize ()
 
std::vector< DwarfStringPoolEntryRefgetEntriesForEmission () const
 Return the list of strings to be emitted.
 

Detailed Description

A string table that doesn't need relocations.

Use this class when a string table doesn't need relocations. This class provides this ability by just associating offsets with strings.

Definition at line 23 of file NonRelocatableStringpool.h.

Member Typedef Documentation

◆ MapTy

Entries are stored into the StringMap and simply linked together through the second element of this pair in order to keep track of insertion order.

Definition at line 28 of file NonRelocatableStringpool.h.

Constructor & Destructor Documentation

◆ NonRelocatableStringpool()

llvm::NonRelocatableStringpool::NonRelocatableStringpool ( bool  PutEmptyString = false)
inline

Definition at line 30 of file NonRelocatableStringpool.h.

References getEntry().

Member Function Documentation

◆ getEntriesForEmission()

std::vector< DwarfStringPoolEntryRef > llvm::NonRelocatableStringpool::getEntriesForEmission ( ) const

Return the list of strings to be emitted.

This does not contain the strings which were added via internString only.

Definition at line 34 of file NonRelocatableStringpool.cpp.

References A, B, E, llvm::StringMapImpl::size(), and llvm::sort().

Referenced by llvm::dwarf_linker::classic::DwarfStreamer::emitLineStrings(), and llvm::dwarf_linker::classic::DwarfStreamer::emitStrings().

◆ getEntry()

DwarfStringPoolEntryRef llvm::NonRelocatableStringpool::getEntry ( StringRef  S)

◆ getSize()

uint64_t llvm::NonRelocatableStringpool::getSize ( )
inline

Definition at line 49 of file NonRelocatableStringpool.h.

◆ getStringOffset()

uint64_t llvm::NonRelocatableStringpool::getStringOffset ( StringRef  S)
inline

Get the offset of string S in the string table.

This can insert a new element or return the offset of a pre-existing one.

Definition at line 39 of file NonRelocatableStringpool.h.

References getEntry(), and llvm::DwarfStringPoolEntryRef::getOffset().

◆ internString()

StringRef llvm::NonRelocatableStringpool::internString ( StringRef  S)

Get permanent storage for S (but do not necessarily emit S in the output section).

A latter call to getStringOffset() with the same string will chain it though.

Returns
The StringRef that points to permanent storage to use in place of S.

Definition at line 26 of file NonRelocatableStringpool.cpp.

References llvm::StringMap< ValueTy, AllocatorTy >::insert(), and llvm::DwarfStringPoolEntry::NotIndexed.


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