Bartleby 0.1.0
A symbol renaming toolkit
All Classes Files Functions Variables Typedefs Friends Macros Pages
Public Member Functions | List of all members
saq::bartleby::Symbol Class Reference

An high view of a symbol. More...

#include <Symbol.h>

Public Member Functions

bool isGlobal () const noexcept
 Returns the visibility of the symbol.
 
bool isDefined () const noexcept
 Returns the definedness of the symbol.
 
size_t getReferences () const noexcept
 Counts how many times this symbol is referenced.
 
std::optional< llvm::StringRef > getOverwriteName () const noexcept
 Returns the overwrite name.
 
bool isMachO () const noexcept
 Returns true if the symbol contains references to some mach-o symbols.
 
void setName (std::string Name) noexcept
 Sets the name of the symbol.
 
void updateWithNewSymbolInfo (const SymbolInfo &Syminfo) noexcept
 Updates the symbol with new symbol information.
 
 Symbol () noexcept
 Constructs a new symbol.
 
 Symbol (const Symbol &) noexcept=delete
 
 Symbol (Symbol &&) noexcept=default
 
Symboloperator= (const Symbol &) noexcept=delete
 
Symboloperator= (Symbol &&) noexcept=default
 

Detailed Description

An high view of a symbol.

Constructor & Destructor Documentation

◆ Symbol()

BARTLEBY_API Symbol::Symbol ( )
noexcept

Constructs a new symbol.

33{}

Member Function Documentation

◆ getOverwriteName()

BARTLEBY_API std::optional< llvm::StringRef > Symbol::getOverwriteName ( ) const
noexcept

Returns the overwrite name.

Returns
The overwrite name.
65 {
66 return OverwriteName;
67}

◆ getReferences()

size_t saq::bartleby::Symbol::getReferences ( ) const
noexcept

Counts how many times this symbol is referenced.

Returns
Number of references.

◆ isDefined()

BARTLEBY_API bool Symbol::isDefined ( ) const
noexcept

Returns the definedness of the symbol.

Returns
True if symbol is defined, else false.
62{ return Defined; }

◆ isGlobal()

BARTLEBY_API bool Symbol::isGlobal ( ) const
noexcept

Returns the visibility of the symbol.

Returns
True if symbol is global, else false.
60{ return Global; }

◆ isMachO()

bool Symbol::isMachO ( ) const
noexcept

Returns true if the symbol contains references to some mach-o symbols.

Returns
True if the symbol contains references to some mach-o, else false.
52 {
53 return Type == llvm::Triple::ObjectFormatType::MachO;
54}

◆ setName()

BARTLEBY_API void Symbol::setName ( std::string  Name)
noexcept

Sets the name of the symbol.

Parameters
nameName to set.
56 {
57 OverwriteName = Name;
58}

◆ updateWithNewSymbolInfo()

void Symbol::updateWithNewSymbolInfo ( const SymbolInfo Syminfo)
noexcept

Updates the symbol with new symbol information.

Parameters
syminfoSymbol information.
35 {
36 assert(SymInfo.Err == false);
37
38 if ((*SymInfo.Flags & llvm::object::BasicSymbolRef::Flags::SF_Weak) == 0) {
39 if ((*SymInfo.Flags & llvm::object::BasicSymbolRef::Flags::SF_Undefined) ==
40 0) {
41 LLVM_DEBUG(llvm::errs() << "symbol is defined. marked as defined\n");
42 Defined = true;
43 }
44 if (*SymInfo.Flags & llvm::object::BasicSymbolRef::Flags::SF_Global) {
45 LLVM_DEBUG(llvm::errs() << "symbol is global. marked as defined\n");
46 Global = true;
47 }
48 }
49 Type = SymInfo.ObjectType;
50}

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