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

Canonicalizer for mangled names. More...

#include "llvm/ProfileData/ItaniumManglingCanonicalizer.h"

Classes

struct  Impl
 

Public Types

enum class  EquivalenceError { Success , ManglingAlreadyUsed , InvalidFirstMangling , InvalidSecondMangling }
 
enum class  FragmentKind { Name , Type , Encoding }
 
using Key = uintptr_t
 

Public Member Functions

 ItaniumManglingCanonicalizer ()
 
 ItaniumManglingCanonicalizer (const ItaniumManglingCanonicalizer &)=delete
 
void operator= (const ItaniumManglingCanonicalizer &)=delete
 
 ~ItaniumManglingCanonicalizer ()
 
EquivalenceError addEquivalence (FragmentKind Kind, StringRef First, StringRef Second)
 Add an equivalence between First and Second.
 
Key canonicalize (StringRef Mangling)
 Form a canonical key for the specified mangling.
 
Key lookup (StringRef Mangling)
 Find a canonical key for the specified mangling, if one has already been formed.
 

Detailed Description

Canonicalizer for mangled names.

This class allows specifying a list of "equivalent" manglings. For example, you can specify that Ss is equivalent to NSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE and then manglings that refer to libstdc++'s 'std::string' will be considered equivalent to manglings that are the same except that they refer to libc++'s 'std::string'.

This can be used when data (eg, profiling data) is available for a version of a program built in a different configuration, with correspondingly different manglings.

Definition at line 35 of file ItaniumManglingCanonicalizer.h.

Member Typedef Documentation

◆ Key

Definition at line 71 of file ItaniumManglingCanonicalizer.h.

Member Enumeration Documentation

◆ EquivalenceError

Enumerator
Success 
ManglingAlreadyUsed 

Both the equivalent manglings have already been used as components of some other mangling we've looked at.

It's too late to add this equivalence.

InvalidFirstMangling 

The first equivalent mangling is invalid.

InvalidSecondMangling 

The second equivalent mangling is invalid.

Definition at line 42 of file ItaniumManglingCanonicalizer.h.

◆ FragmentKind

Enumerator
Name 

The mangling fragment is a <name> (or a predefined <substitution>).

Type 

The mangling fragment is a <type>.

Encoding 

The mangling fragment is an <encoding>.

Definition at line 57 of file ItaniumManglingCanonicalizer.h.

Constructor & Destructor Documentation

◆ ItaniumManglingCanonicalizer() [1/2]

ItaniumManglingCanonicalizer::ItaniumManglingCanonicalizer ( )

Definition at line 203 of file ItaniumManglingCanonicalizer.cpp.

◆ ItaniumManglingCanonicalizer() [2/2]

llvm::ItaniumManglingCanonicalizer::ItaniumManglingCanonicalizer ( const ItaniumManglingCanonicalizer )
delete

◆ ~ItaniumManglingCanonicalizer()

ItaniumManglingCanonicalizer::~ItaniumManglingCanonicalizer ( )

Definition at line 204 of file ItaniumManglingCanonicalizer.cpp.

References P.

Member Function Documentation

◆ addEquivalence()

ItaniumManglingCanonicalizer::EquivalenceError ItaniumManglingCanonicalizer::addEquivalence ( FragmentKind  Kind,
StringRef  First,
StringRef  Second 
)

Add an equivalence between First and Second.

Both manglings must live at least as long as the canonicalizer.

Definition at line 207 of file ItaniumManglingCanonicalizer.cpp.

References llvm::Alloc, Encoding, llvm::First, InvalidFirstMangling, InvalidSecondMangling, ManglingAlreadyUsed, N, Name, P, Success, and Type.

Referenced by llvm::SymbolRemappingReader::read().

◆ canonicalize()

ItaniumManglingCanonicalizer::Key ItaniumManglingCanonicalizer::canonicalize ( StringRef  Mangling)

Form a canonical key for the specified mangling.

They key will be the same for all equivalent manglings, and different for any two non-equivalent manglings, but is otherwise unspecified.

Returns Key() if (and only if) the mangling is not a valid Itanium C++ ABI mangling.

The string denoted by Mangling must live as long as the canonicalizer.

Definition at line 302 of file ItaniumManglingCanonicalizer.cpp.

References P, and parseMaybeMangledName().

Referenced by llvm::SymbolRemappingReader::insert().

◆ lookup()

ItaniumManglingCanonicalizer::Key ItaniumManglingCanonicalizer::lookup ( StringRef  Mangling)

Find a canonical key for the specified mangling, if one has already been formed.

Otherwise returns Key().

Definition at line 307 of file ItaniumManglingCanonicalizer.cpp.

References P, and parseMaybeMangledName().

Referenced by llvm::SymbolRemappingReader::lookup().

◆ operator=()

void llvm::ItaniumManglingCanonicalizer::operator= ( const ItaniumManglingCanonicalizer )
delete

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