LLVM 24.0.0git
llvm::orc::Mangler Class Reference

Applies linker name-mangling for a target. More...

#include "llvm/ExecutionEngine/Orc/Shared/Mangler.h"

Public Types

enum class  Mode {
  None , ELF , MachO , WinCOFF ,
  WinCOFFX86 , GOFF , Mips , XCOFF
}
 The linker name-mangling scheme for a target, determined by its object format. More...

Public Member Functions

 Mangler (Mode MM)
 Mangler (StringRef DLStr)
 Mangler (const Triple &TT, StringRef ABIName="")
template<typename HandlerFn>
decltype(auto) withMangledNameDo (HandlerFn &&H, const SymbolNameSpec &NameSpec) const
 Calls the given callback with the mangled version of NameSpec as a StringRef.
std::string mangledCopy (const SymbolNameSpec &Name) const
 Construct a mangled version of the given name as a std::string.

Detailed Description

Applies linker name-mangling for a target.

Definition at line 28 of file Mangler.h.

Member Enumeration Documentation

◆ Mode

enum class llvm::orc::Mangler::Mode
strong

The linker name-mangling scheme for a target, determined by its object format.

This captures the platform decoration applied to symbol names (e.g. a leading '_' on MachO), independently of any ExecutionSession.

Enumerator
None 
ELF 
MachO 
WinCOFF 
WinCOFFX86 
GOFF 
Mips 
XCOFF 

Definition at line 33 of file Mangler.h.

Constructor & Destructor Documentation

◆ Mangler() [1/3]

llvm::orc::Mangler::Mangler ( Mode MM)
inlineexplicit

Definition at line 35 of file Mangler.h.

◆ Mangler() [2/3]

llvm::orc::Mangler::Mangler ( StringRef DLStr)
inlineexplicit

Definition at line 36 of file Mangler.h.

◆ Mangler() [3/3]

llvm::orc::Mangler::Mangler ( const Triple & TT,
StringRef ABIName = "" )
inlineexplicit

Definition at line 37 of file Mangler.h.

Member Function Documentation

◆ mangledCopy()

std::string llvm::orc::Mangler::mangledCopy ( const SymbolNameSpec & Name) const
inline

Construct a mangled version of the given name as a std::string.

This always produces a copy, even for no-op manglings. Prefer withMangledNameDo in any performance-sensitive context.

Definition at line 72 of file Mangler.h.

References llvm::StringRef::str(), and withMangledNameDo().

◆ withMangledNameDo()

template<typename HandlerFn>
decltype(auto) llvm::orc::Mangler::withMangledNameDo ( HandlerFn && H,
const SymbolNameSpec & NameSpec ) const
inline

Calls the given callback with the mangled version of NameSpec as a StringRef.

The mangled name is only valid for the duration of the callback and must not escape. This allows withMangledNameDo to avoid allocations when mangling is a no-op.

Definition at line 45 of file Mangler.h.

References llvm::SmallString< InternalLen >::append(), llvm::StringRef::empty(), llvm::orc::SymbolNameSpec::getKind(), llvm::orc::SymbolNameSpec::getName(), H, llvm::orc::Linker, MachO, llvm::StringRef::substr(), llvm::orc::Verbatim, and WinCOFFX86.

Referenced by mangledCopy().


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