LLVM  14.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. More...
 

Public Member Functions

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

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 ( std::function< StringRef(StringRef Input)>  Translator = nullptr,
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 41 of file NonRelocatableStringpool.cpp.

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

◆ getEntry()

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

◆ getSize()

uint64_t llvm::NonRelocatableStringpool::getSize ( )
inline

Definition at line 52 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 42 of file NonRelocatableStringpool.h.

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

◆ 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 30 of file NonRelocatableStringpool.cpp.

Referenced by llvm::DeclContextTree::getChildDeclContext(), and llvm::CachedPathResolver::resolve().


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