Bartleby 0.1.0
A symbol renaming toolkit
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | Friends | List of all members
saq::bartleby::ObjectFormat Struct Reference

Object format. More...

#include <Bartleby.h>

Classes

struct  Hash
 std::hash implementation for ObjectFormat. More...
 

Public Member Functions

 ObjectFormat (const llvm::Triple &Triple) noexcept
 Constructs an ObjectFormat out of a llvm::Triple.
 
uint64_t pack () const noexcept
 Packs the architecture, sub-architecture and object format file enums into a 8-bytes unsigned integer.
 
bool operator== (const ObjectFormat &Other) const noexcept
 
bool matches (const llvm::Triple &Triple) const noexcept
 Verifies that a llvm::Triple matches the value from an ObjectFormat.
 

Public Attributes

llvm::Triple::ArchType Arch
 The architecture.
 
llvm::Triple::SubArchType SubArch
 The sub-architecture.
 
llvm::Triple::ObjectFormatType FormatType
 The object format file.
 

Friends

llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const ObjectFormat &Format) noexcept
 Dumps the ObjectFormat to a llvm::raw_ostream.
 

Detailed Description

Object format.

This structure defines an object format using the minimum amount of information. It uses the architecture type (llvm::Triple::ArchType), the sub-architecture type (llvm::Triple::SubArchType) and the object file format (llvm::Triple::ObjectFormatType).

Constructor & Destructor Documentation

◆ ObjectFormat()

ObjectFormat::ObjectFormat ( const llvm::Triple &  Triple)
noexcept

Constructs an ObjectFormat out of a llvm::Triple.

Parameters
TripleThe triple to use.
127 : Arch(Triple.getArch()), SubArch(Triple.getSubArch()),
128 FormatType(Triple.getObjectFormat()) {}
llvm::Triple::ObjectFormatType FormatType
The object format file.
Definition: Bartleby.h:48
llvm::Triple::SubArchType SubArch
The sub-architecture.
Definition: Bartleby.h:45
llvm::Triple::ArchType Arch
The architecture.
Definition: Bartleby.h:42

Member Function Documentation

◆ matches()

bool ObjectFormat::matches ( const llvm::Triple &  Triple) const
noexcept

Verifies that a llvm::Triple matches the value from an ObjectFormat.

Parameters
TripleThe triple to compare against the ObjectFormat.
Returns
True if the given triple has the same architecture, sub-architecture and object format than the ones stored in ObjectFormat.
140 {
141 return ObjectFormat{Triple}.pack() == pack();
142}
Object format.
Definition: Bartleby.h:40
uint64_t pack() const noexcept
Packs the architecture, sub-architecture and object format file enums into a 8-bytes unsigned integer...
Definition: Bartleby.cpp:130

◆ operator==()

bool ObjectFormat::operator== ( const ObjectFormat Other) const
noexcept
136 {
137 return pack() == Other.pack();
138}

◆ pack()

uint64_t ObjectFormat::pack ( ) const
noexcept

Packs the architecture, sub-architecture and object format file enums into a 8-bytes unsigned integer.

Returns
The packed values as a 8-bytes unsigned integer.
130 {
131 return (static_cast<uint64_t>(Arch)) |
132 (static_cast<uint64_t>(SubArch) << 16) |
133 (static_cast<uint64_t>(FormatType) << 32);
134}

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