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

Canonicalizer for mangled names. More...

#include "llvm/Support/ItaniumManglingCanonicalizer.h"

Classes

struct  Impl
 

Public Types

enum  EquivalenceError { EquivalenceError::Success, EquivalenceError::ManglingAlreadyUsed, EquivalenceError::InvalidFirstMangling, EquivalenceError::InvalidSecondMangling }
 
enum  FragmentKind { FragmentKind::Name, FragmentKind::Type, FragmentKind::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. More...
 
Key canonicalize (StringRef Mangling)
 Form a canonical key for the specified mangling. More...
 
Key lookup (StringRef Mangling)
 Find a canonical key for the specified mangling, if one has already been formed. More...
 

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 34 of file ItaniumManglingCanonicalizer.h.

Member Typedef Documentation

◆ Key

Definition at line 70 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 41 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 56 of file ItaniumManglingCanonicalizer.h.

Constructor & Destructor Documentation

◆ ItaniumManglingCanonicalizer() [1/2]

ItaniumManglingCanonicalizer::ItaniumManglingCanonicalizer ( )

Definition at line 232 of file ItaniumManglingCanonicalizer.cpp.

◆ ItaniumManglingCanonicalizer() [2/2]

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

◆ ~ItaniumManglingCanonicalizer()

ItaniumManglingCanonicalizer::~ItaniumManglingCanonicalizer ( )

Definition at line 233 of file ItaniumManglingCanonicalizer.cpp.

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 236 of file ItaniumManglingCanonicalizer.cpp.

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 311 of file ItaniumManglingCanonicalizer.cpp.

References llvm::StringRef::begin(), and llvm::StringRef::end().

◆ 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 318 of file ItaniumManglingCanonicalizer.cpp.

References llvm::StringRef::begin(), and llvm::StringRef::end().

◆ operator=()

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

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