retdec
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
retdec::llvmir2hll::Module Class Referencefinal

A representation of a complete module. More...

#include <module.h>

Inheritance diagram for retdec::llvmir2hll::Module:
Inheritance graph
[legend]
Collaboration diagram for retdec::llvmir2hll::Module:
Collaboration graph
[legend]

Public Types

using global_var_iterator = GlobalVarDefVector::const_iterator
 Global variable iterator. More...
 
using func_iterator = FuncVector::const_iterator
 Function iterator. More...
 
using func_filter_iterator = retdec::utils::FilterIterator< func_iterator >
 Iterator over filtered functions (definitions, declarations, etc.). More...
 

Public Member Functions

 Module (const llvm::Module *llvmModule, const std::string &identifier, ShPtr< Semantics > semantics, ShPtr< Config > config)
 Constructs a new module. More...
 
const llvm::Module * getLLVMModule () const
 Returns the underlying LLVM module of the module. More...
 
std::string getIdentifier (bool stripDirs=true) const
 Returns the identifier of the module. More...
 
ShPtr< SemanticsgetSemantics () const
 Returns the semantics of the module. More...
 
ShPtr< ConfiggetConfig () const
 
Global Variables Accessors
void addGlobalVar (ShPtr< Variable > var, ShPtr< Expression > init=nullptr)
 Adds a new global variable to the module. More...
 
void removeGlobalVar (ShPtr< Variable > var)
 Removes the given variable from the module. More...
 
bool isGlobalVar (ShPtr< Variable > var) const
 Returns true if var is a global variable, false otherwise. More...
 
bool isGlobalVarStoringStringLiteral (const std::string &varName) const
 Is a variable with the given name global and stores a string literal? More...
 
ShPtr< ExpressiongetInitForGlobalVar (ShPtr< Variable > var) const
 Returns the initializer for the given global variable var. More...
 
ShPtr< VariablegetGlobalVarByName (const std::string &varName) const
 Returns the global variable named varName. More...
 
bool hasGlobalVars () const
 Returns true if the module contains at least one global variable, false otherwise. More...
 
bool hasGlobalVar (const std::string &name) const
 Checks if the module contains a global variable with the given name. More...
 
VarSet getGlobalVars () const
 Returns all global variables (without their initializer). More...
 
VarSet getExternalGlobalVars () const
 Returns the set of external global variables. More...
 
std::string getRegisterForGlobalVar (ShPtr< Variable > var) const
 Returns the name of the register corresponding to the given global variable. More...
 
std::string getDetectedCryptoPatternForGlobalVar (ShPtr< Variable > var) const
 Returns a description of the detected cryptographic pattern for the given global variable. More...
 
global_var_iterator global_var_begin () const
 Returns a constant iterator to the first global variable. More...
 
global_var_iterator global_var_end () const
 Returns a constant iterator past the last global variable. More...
 
Functions Accessors
void addFunc (ShPtr< Function > func)
 Adds the given function to the module. More...
 
void removeFunc (ShPtr< Function > func)
 Removes the given function from the module. More...
 
bool funcExists (ShPtr< Function > func) const
 Returns true if func exists in the module, false otherwise. More...
 
ShPtr< FunctiongetFuncByName (const std::string &funcName) const
 Returns the function named funcName. More...
 
bool hasFuncWithName (const std::string &funcName) const
 Returns true if there is a function named funcName, false otherwise. More...
 
bool correspondsToFunc (ShPtr< Variable > var) const
 Does the given variable correspond to a function? More...
 
bool hasMainFunc () const
 Returns true if there is a main function in the module, false otherwise. More...
 
bool isMainFunc (ShPtr< Function > func) const
 Returns true if the given function is the main function, false otherwise. More...
 
VarSet getVarsForFuncs () const
 Returns variables that correspond to functions in the module. More...
 
std::size_t getNumOfFuncDefinitions () const
 Returns the number of defined functions in the module. More...
 
bool hasFuncDefinitions () const
 Returns true if the module contains at least one function definition, false otherwise. More...
 
bool hasDecompilerDefinedFuncs () const
 Are there any decompiler-defined functions in the module? More...
 
FuncSet getDecompilerDefinedFuncs () const
 Returns all decompiler-defined functions in the module. More...
 
bool hasUserDefinedFuncs () const
 Are there any user-defied functions in the module? More...
 
FuncSet getUserDefinedFuncs () const
 Returns all user-defined functions in the module. More...
 
bool hasStaticallyLinkedFuncs () const
 Are there any statically linked functions in the module? More...
 
FuncSet getStaticallyLinkedFuncs () const
 Returns all statically linked functions in the module. More...
 
void markFuncAsStaticallyLinked (ShPtr< Function > func)
 Marks the given function as statically linked. More...
 
bool hasDynamicallyLinkedFuncs () const
 Are there any dynamically linked functions in the module? More...
 
FuncSet getDynamicallyLinkedFuncs () const
 Returns all dynamically linked functions in the module. More...
 
bool hasSyscallFuncs () const
 Are there any syscall functions in the module? More...
 
FuncSet getSyscallFuncs () const
 Returns all syscall functions in the module. More...
 
bool hasInstructionIdiomFuncs () const
 Are there any syscall functions in the module? More...
 
FuncSet getInstructionIdiomFuncs () const
 Returns all syscall functions in the module. More...
 
bool isExportedFunc (ShPtr< Function > func) const
 Is the given function exported? More...
 
std::string getRealNameForFunc (ShPtr< Function > func) const
 Returns the real name of the given function. More...
 
std::string getDeclarationStringForFunc (ShPtr< Function > func) const
 Returns a C declaration string for the given function. More...
 
std::string getCommentForFunc (ShPtr< Function > func) const
 Returns a comment for func. More...
 
StringSet getDetectedCryptoPatternsForFunc (ShPtr< Function > func) const
 Returns a set of names of detected cryptographic patterns that the given function uses. More...
 
std::string getWrappedFuncName (ShPtr< Function > func) const
 Returns the name of a function that func wraps. More...
 
std::string getDemangledNameOfFunc (ShPtr< Function > func) const
 Returns the demangled name of func. More...
 
AddressRange getAddressRangeForFunc (ShPtr< const Function > func) const
 Returns the address range for the given function. More...
 
bool hasAddressRange (ShPtr< Function > func) const
 Has the given function an address range? More...
 
bool allFuncDefinitionsHaveAddressRange () const
 Checks if all function definitions have an address range. More...
 
LineRange getLineRangeForFunc (ShPtr< Function > func) const
 Returns the line range for the given function. More...
 
bool hasLineRange (ShPtr< Function > func) const
 Has the given function a line range? More...
 
bool allFuncDefinitionsHaveLineRange () const
 Checks if all function definitions have a line range. More...
 
func_iterator func_begin () const
 Returns a constant iterator to the first function. More...
 
func_iterator func_end () const
 Returns a constant iterator past the last function. More...
 
func_filter_iterator func_definition_begin () const
 Returns a constant iterator to the first function definition. More...
 
func_filter_iterator func_definition_end () const
 Returns a constant iterator past the last function definition. More...
 
func_filter_iterator func_declaration_begin () const
 Returns a constant iterator to the first function declaration. More...
 
func_filter_iterator func_declaration_end () const
 Returns a constant iterator past the last function declaration. More...
 
Local Variables Accessors
std::string comesFromGlobalVar (ShPtr< Function > func, ShPtr< Variable > var) const
 Returns the name of a global variable from which the given local variable comes from. More...
 
Classes Accessors
bool hasClasses () const
 Have any classes been found? More...
 
StringSet getClassNames () const
 Returns the set of found class names. More...
 
std::string getClassForFunc (ShPtr< Function > func) const
 Returns the name of a class to which the given function belongs. More...
 
std::string getTypeOfFuncInClass (ShPtr< Function > func, const std::string &cl) const
 Returns the type of the given function in the given class. More...
 
StringVector getBaseClassNames (const std::string &cl) const
 Returns the names of base classes of the given class. More...
 
std::string getDemangledNameOfClass (const std::string &cl) const
 Returns the demangled named of the given class. More...
 
Debug Info Accessors
bool isDebugInfoAvailable () const
 Is debugging information available? More...
 
std::string getDebugModuleNameForFunc (ShPtr< Function > func) const
 Returns the module name for the given function using debug information. More...
 
bool hasAssignedDebugModuleName (ShPtr< Function > func) const
 Has the given function assigned a module name from debug information? More...
 
StringSet getDebugModuleNames () const
 Returns the set of all module names for all functions. More...
 
std::string getDebugNameForGlobalVar (ShPtr< Variable > var) const
 Returns the name for the given global variable using debug information. More...
 
std::string getDebugNameForLocalVar (ShPtr< Function > func, ShPtr< Variable > var) const
 Returns the name for the given local variable using debug information. More...
 
std::string getDebugNameForVar (ShPtr< Variable > var) const
 Returns the name for the given variable using debug information. More...
 
bool hasAssignedDebugName (ShPtr< Variable > var) const
 Returns true if the given variable has assigned a name from debug information, false otherwise. More...
 
void addDebugNameForVar (ShPtr< Variable > var, const std::string &name)
 Adds a name for the given variable using debug information. More...
 
Meta Information
std::size_t getNumberOfFuncsDetectedInFrontend () const
 Returns the number of functions detected in the front-end. More...
 
std::string getDetectedCompilerOrPacker () const
 Returns the detected compiler/packer. More...
 
std::string getDetectedLanguage () const
 Returns the detected language. More...
 
StringSet getSelectedButNotFoundFuncs () const
 Returns a set of functions that were selected to be decompiled but were not found. More...
 

Private Types

using FuncAddressRangeMap = std::map< ShPtr< Function >, AddressRange >
 Mapping of a function into an address range. More...
 

Private Member Functions

bool hasFuncSatisfyingPredicate (std::function< bool(ShPtr< Function >)> pred) const
 Is there a function satisfying the given predicate? More...
 
FuncSet getFuncsSatisfyingPredicate (std::function< bool(ShPtr< Function >)> pred) const
 Returns a set of functions satisfying the given predicate. More...
 
- Private Member Functions inherited from retdec::utils::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 

Private Attributes

const llvm::Module * llvmModule
 Original module from which this module has been created. More...
 
std::string identifier
 Identifier of the module. More...
 
ShPtr< Semanticssemantics
 The used semantics. More...
 
ShPtr< Configconfig
 The used config. More...
 
GlobalVarDefVector globalVars
 Global variables. More...
 
FuncVector funcs
 Functions. More...
 
VarStringMap debugVarNameMap
 Mapping of a variable into its name in the debug information. More...
 

Detailed Description

A representation of a complete module.

Instances of this class have reference object semantics. This class is not meant to be subclassed.

Member Typedef Documentation

◆ func_filter_iterator

Iterator over filtered functions (definitions, declarations, etc.).

◆ func_iterator

using retdec::llvmir2hll::Module::func_iterator = FuncVector::const_iterator

Function iterator.

◆ FuncAddressRangeMap

Mapping of a function into an address range.

◆ global_var_iterator

using retdec::llvmir2hll::Module::global_var_iterator = GlobalVarDefVector::const_iterator

Global variable iterator.

Constructor & Destructor Documentation

◆ Module()

retdec::llvmir2hll::Module::Module ( const llvm::Module *  llvmModule,
const std::string &  identifier,
ShPtr< Semantics semantics,
ShPtr< Config config 
)

Constructs a new module.

Parameters
[in]llvmModuleOriginal module from which this module has been created.
[in]identifierIdentifier of the module.
[in]semanticsThe used semantics.
[in]configConfiguration for the module.
Preconditions
  • both llvmModule and semantics are non-null

Member Function Documentation

◆ addDebugNameForVar()

void retdec::llvmir2hll::Module::addDebugNameForVar ( ShPtr< Variable var,
const std::string &  name 
)

Adds a name for the given variable using debug information.

The new name overwrites any name that has already been set for var.

◆ addFunc()

void retdec::llvmir2hll::Module::addFunc ( ShPtr< Function func)

Adds the given function to the module.

Parameters
[in]funcFunction to be added.

If the function already exists in the module, nothing is done.

◆ addGlobalVar()

void retdec::llvmir2hll::Module::addGlobalVar ( ShPtr< Variable var,
ShPtr< Expression init = nullptr 
)

Adds a new global variable to the module.

Parameters
[in]varVariable to be added.
[in]initInitializer of var.

If the global variable already exists, it replaces its initializer with init.

Time complexity: O(n), where n is the number of global variables in the module.

◆ allFuncDefinitionsHaveAddressRange()

bool retdec::llvmir2hll::Module::allFuncDefinitionsHaveAddressRange ( ) const

Checks if all function definitions have an address range.

◆ allFuncDefinitionsHaveLineRange()

bool retdec::llvmir2hll::Module::allFuncDefinitionsHaveLineRange ( ) const

Checks if all function definitions have a line range.

◆ comesFromGlobalVar()

std::string retdec::llvmir2hll::Module::comesFromGlobalVar ( ShPtr< Function func,
ShPtr< Variable var 
) const

Returns the name of a global variable from which the given local variable comes from.

If the given variable does not come from a global variable, the empty string is returned.

◆ correspondsToFunc()

bool retdec::llvmir2hll::Module::correspondsToFunc ( ShPtr< Variable var) const

Does the given variable correspond to a function?

◆ func_begin()

Module::func_iterator retdec::llvmir2hll::Module::func_begin ( ) const

Returns a constant iterator to the first function.

◆ func_declaration_begin()

Module::func_filter_iterator retdec::llvmir2hll::Module::func_declaration_begin ( ) const

Returns a constant iterator to the first function declaration.

◆ func_declaration_end()

Module::func_filter_iterator retdec::llvmir2hll::Module::func_declaration_end ( ) const

Returns a constant iterator past the last function declaration.

◆ func_definition_begin()

Module::func_filter_iterator retdec::llvmir2hll::Module::func_definition_begin ( ) const

Returns a constant iterator to the first function definition.

◆ func_definition_end()

Module::func_filter_iterator retdec::llvmir2hll::Module::func_definition_end ( ) const

Returns a constant iterator past the last function definition.

◆ func_end()

Module::func_iterator retdec::llvmir2hll::Module::func_end ( ) const

Returns a constant iterator past the last function.

◆ funcExists()

bool retdec::llvmir2hll::Module::funcExists ( ShPtr< Function func) const

Returns true if func exists in the module, false otherwise.

func may be either a function definition or a function declaration.

◆ getAddressRangeForFunc()

AddressRange retdec::llvmir2hll::Module::getAddressRangeForFunc ( ShPtr< const Function func) const

Returns the address range for the given function.

If there is no address range for func, NO_ADDRESS_RANGE is returned.

◆ getBaseClassNames()

StringVector retdec::llvmir2hll::Module::getBaseClassNames ( const std::string &  cl) const

Returns the names of base classes of the given class.

◆ getClassForFunc()

std::string retdec::llvmir2hll::Module::getClassForFunc ( ShPtr< Function func) const

Returns the name of a class to which the given function belongs.

If func does not belong to any class, the empty string is returned.

◆ getClassNames()

StringSet retdec::llvmir2hll::Module::getClassNames ( ) const

Returns the set of found class names.

◆ getCommentForFunc()

std::string retdec::llvmir2hll::Module::getCommentForFunc ( ShPtr< Function func) const

Returns a comment for func.

◆ getConfig()

ShPtr< Config > retdec::llvmir2hll::Module::getConfig ( ) const

◆ getDebugModuleNameForFunc()

std::string retdec::llvmir2hll::Module::getDebugModuleNameForFunc ( ShPtr< Function func) const

Returns the module name for the given function using debug information.

If there is no module name assigned to the given function, the empty string is returned.

◆ getDebugModuleNames()

StringSet retdec::llvmir2hll::Module::getDebugModuleNames ( ) const

Returns the set of all module names for all functions.

If debug info is not available or there are no functions, the empty set is returned.

◆ getDebugNameForGlobalVar()

std::string retdec::llvmir2hll::Module::getDebugNameForGlobalVar ( ShPtr< Variable var) const

Returns the name for the given global variable using debug information.

If there is no name assigned to the given variable, the empty string is returned.

◆ getDebugNameForLocalVar()

std::string retdec::llvmir2hll::Module::getDebugNameForLocalVar ( ShPtr< Function func,
ShPtr< Variable var 
) const

Returns the name for the given local variable using debug information.

If there is no name assigned to the given variable, the empty string is returned.

◆ getDebugNameForVar()

std::string retdec::llvmir2hll::Module::getDebugNameForVar ( ShPtr< Variable var) const

Returns the name for the given variable using debug information.

If there is no name assigned to the given variable, the empty string is returned.

◆ getDeclarationStringForFunc()

std::string retdec::llvmir2hll::Module::getDeclarationStringForFunc ( ShPtr< Function func) const

Returns a C declaration string for the given function.

If there is no declaration string attached to the given function, it returns the empty string.

◆ getDecompilerDefinedFuncs()

FuncSet retdec::llvmir2hll::Module::getDecompilerDefinedFuncs ( ) const

Returns all decompiler-defined functions in the module.

◆ getDemangledNameOfClass()

std::string retdec::llvmir2hll::Module::getDemangledNameOfClass ( const std::string &  cl) const

Returns the demangled named of the given class.

◆ getDemangledNameOfFunc()

std::string retdec::llvmir2hll::Module::getDemangledNameOfFunc ( ShPtr< Function func) const

Returns the demangled name of func.

◆ getDetectedCompilerOrPacker()

std::string retdec::llvmir2hll::Module::getDetectedCompilerOrPacker ( ) const

Returns the detected compiler/packer.

If there is no detected compiler/packer, it returns the empty string.

◆ getDetectedCryptoPatternForGlobalVar()

std::string retdec::llvmir2hll::Module::getDetectedCryptoPatternForGlobalVar ( ShPtr< Variable var) const

Returns a description of the detected cryptographic pattern for the given global variable.

◆ getDetectedCryptoPatternsForFunc()

StringSet retdec::llvmir2hll::Module::getDetectedCryptoPatternsForFunc ( ShPtr< Function func) const

Returns a set of names of detected cryptographic patterns that the given function uses.

If the given function does not use any cryptographic patterns, the empty set is returned.

◆ getDetectedLanguage()

std::string retdec::llvmir2hll::Module::getDetectedLanguage ( ) const

Returns the detected language.

If there is no detected language, it returns the empty string.

◆ getDynamicallyLinkedFuncs()

FuncSet retdec::llvmir2hll::Module::getDynamicallyLinkedFuncs ( ) const

Returns all dynamically linked functions in the module.

◆ getExternalGlobalVars()

VarSet retdec::llvmir2hll::Module::getExternalGlobalVars ( ) const

Returns the set of external global variables.

◆ getFuncByName()

ShPtr< Function > retdec::llvmir2hll::Module::getFuncByName ( const std::string &  funcName) const

Returns the function named funcName.

Parameters
[in]funcNameName of the function.

If there is no function named funcName, it returns the null pointer.

◆ getFuncsSatisfyingPredicate()

FuncSet retdec::llvmir2hll::Module::getFuncsSatisfyingPredicate ( std::function< bool(ShPtr< Function >)>  pred) const
private

Returns a set of functions satisfying the given predicate.

◆ getGlobalVarByName()

ShPtr< Variable > retdec::llvmir2hll::Module::getGlobalVarByName ( const std::string &  varName) const

Returns the global variable named varName.

Parameters
[in]varNameName of the variable.

If there is no global variable named varName, it returns the null pointer.

Time complexity: O(n), where n is the number of global variables in the module.

◆ getGlobalVars()

VarSet retdec::llvmir2hll::Module::getGlobalVars ( ) const

Returns all global variables (without their initializer).

Time complexity: O(n), where n is the number of global variables in the module.

◆ getIdentifier()

std::string retdec::llvmir2hll::Module::getIdentifier ( bool  stripDirs = true) const

Returns the identifier of the module.

Parameters
[in]stripDirsStrips all directories from the identifier (if any).

◆ getInitForGlobalVar()

ShPtr< Expression > retdec::llvmir2hll::Module::getInitForGlobalVar ( ShPtr< Variable var) const

Returns the initializer for the given global variable var.

If var is not a global variable or if it has no initializer, the null pointer is returned.

Time complexity: O(n), where n is the number of global variables in the module.

◆ getInstructionIdiomFuncs()

FuncSet retdec::llvmir2hll::Module::getInstructionIdiomFuncs ( ) const

Returns all syscall functions in the module.

◆ getLineRangeForFunc()

LineRange retdec::llvmir2hll::Module::getLineRangeForFunc ( ShPtr< Function func) const

Returns the line range for the given function.

If there is no line range for func, NO_LINE_RANGE is returned.

◆ getLLVMModule()

const llvm::Module * retdec::llvmir2hll::Module::getLLVMModule ( ) const

Returns the underlying LLVM module of the module.

◆ getNumberOfFuncsDetectedInFrontend()

std::size_t retdec::llvmir2hll::Module::getNumberOfFuncsDetectedInFrontend ( ) const

Returns the number of functions detected in the front-end.

◆ getNumOfFuncDefinitions()

std::size_t retdec::llvmir2hll::Module::getNumOfFuncDefinitions ( ) const

Returns the number of defined functions in the module.

◆ getRealNameForFunc()

std::string retdec::llvmir2hll::Module::getRealNameForFunc ( ShPtr< Function func) const

Returns the real name of the given function.

If there is no real name attached to the given function, it returns the empty string.

◆ getRegisterForGlobalVar()

std::string retdec::llvmir2hll::Module::getRegisterForGlobalVar ( ShPtr< Variable var) const

Returns the name of the register corresponding to the given global variable.

◆ getSelectedButNotFoundFuncs()

StringSet retdec::llvmir2hll::Module::getSelectedButNotFoundFuncs ( ) const

Returns a set of functions that were selected to be decompiled but were not found.

◆ getSemantics()

ShPtr< Semantics > retdec::llvmir2hll::Module::getSemantics ( ) const

Returns the semantics of the module.

◆ getStaticallyLinkedFuncs()

FuncSet retdec::llvmir2hll::Module::getStaticallyLinkedFuncs ( ) const

Returns all statically linked functions in the module.

◆ getSyscallFuncs()

FuncSet retdec::llvmir2hll::Module::getSyscallFuncs ( ) const

Returns all syscall functions in the module.

◆ getTypeOfFuncInClass()

std::string retdec::llvmir2hll::Module::getTypeOfFuncInClass ( ShPtr< Function func,
const std::string &  cl 
) const

Returns the type of the given function in the given class.

The returned value is a textual representation, e.g. "constructor" or "virtual member function". If func does not belong to cl, the empty string is returned.

◆ getUserDefinedFuncs()

FuncSet retdec::llvmir2hll::Module::getUserDefinedFuncs ( ) const

Returns all user-defined functions in the module.

◆ getVarsForFuncs()

VarSet retdec::llvmir2hll::Module::getVarsForFuncs ( ) const

Returns variables that correspond to functions in the module.

◆ getWrappedFuncName()

std::string retdec::llvmir2hll::Module::getWrappedFuncName ( ShPtr< Function func) const

Returns the name of a function that func wraps.

See the description of Config::getWrappedFunc() for more information.

◆ global_var_begin()

Module::global_var_iterator retdec::llvmir2hll::Module::global_var_begin ( ) const

Returns a constant iterator to the first global variable.

◆ global_var_end()

Module::global_var_iterator retdec::llvmir2hll::Module::global_var_end ( ) const

Returns a constant iterator past the last global variable.

◆ hasAddressRange()

bool retdec::llvmir2hll::Module::hasAddressRange ( ShPtr< Function func) const

Has the given function an address range?

◆ hasAssignedDebugModuleName()

bool retdec::llvmir2hll::Module::hasAssignedDebugModuleName ( ShPtr< Function func) const

Has the given function assigned a module name from debug information?

◆ hasAssignedDebugName()

bool retdec::llvmir2hll::Module::hasAssignedDebugName ( ShPtr< Variable var) const

Returns true if the given variable has assigned a name from debug information, false otherwise.

◆ hasClasses()

bool retdec::llvmir2hll::Module::hasClasses ( ) const

Have any classes been found?

◆ hasDecompilerDefinedFuncs()

bool retdec::llvmir2hll::Module::hasDecompilerDefinedFuncs ( ) const

Are there any decompiler-defined functions in the module?

◆ hasDynamicallyLinkedFuncs()

bool retdec::llvmir2hll::Module::hasDynamicallyLinkedFuncs ( ) const

Are there any dynamically linked functions in the module?

◆ hasFuncDefinitions()

bool retdec::llvmir2hll::Module::hasFuncDefinitions ( ) const

Returns true if the module contains at least one function definition, false otherwise.

◆ hasFuncSatisfyingPredicate()

bool retdec::llvmir2hll::Module::hasFuncSatisfyingPredicate ( std::function< bool(ShPtr< Function >)>  pred) const
private

Is there a function satisfying the given predicate?

◆ hasFuncWithName()

bool retdec::llvmir2hll::Module::hasFuncWithName ( const std::string &  funcName) const

Returns true if there is a function named funcName, false otherwise.

◆ hasGlobalVar()

bool retdec::llvmir2hll::Module::hasGlobalVar ( const std::string &  name) const

Checks if the module contains a global variable with the given name.

◆ hasGlobalVars()

bool retdec::llvmir2hll::Module::hasGlobalVars ( ) const

Returns true if the module contains at least one global variable, false otherwise.

◆ hasInstructionIdiomFuncs()

bool retdec::llvmir2hll::Module::hasInstructionIdiomFuncs ( ) const

Are there any syscall functions in the module?

◆ hasLineRange()

bool retdec::llvmir2hll::Module::hasLineRange ( ShPtr< Function func) const

Has the given function a line range?

◆ hasMainFunc()

bool retdec::llvmir2hll::Module::hasMainFunc ( ) const

Returns true if there is a main function in the module, false otherwise.

The name of the main function depends on the used semantics.

◆ hasStaticallyLinkedFuncs()

bool retdec::llvmir2hll::Module::hasStaticallyLinkedFuncs ( ) const

Are there any statically linked functions in the module?

◆ hasSyscallFuncs()

bool retdec::llvmir2hll::Module::hasSyscallFuncs ( ) const

Are there any syscall functions in the module?

◆ hasUserDefinedFuncs()

bool retdec::llvmir2hll::Module::hasUserDefinedFuncs ( ) const

Are there any user-defied functions in the module?

◆ isDebugInfoAvailable()

bool retdec::llvmir2hll::Module::isDebugInfoAvailable ( ) const

Is debugging information available?

◆ isExportedFunc()

bool retdec::llvmir2hll::Module::isExportedFunc ( ShPtr< Function func) const

Is the given function exported?

See the description of Config::isExportedFunc() for more details.

◆ isGlobalVar()

bool retdec::llvmir2hll::Module::isGlobalVar ( ShPtr< Variable var) const

Returns true if var is a global variable, false otherwise.

Time complexity: O(n), where n is the number of global variables in the module.

◆ isGlobalVarStoringStringLiteral()

bool retdec::llvmir2hll::Module::isGlobalVarStoringStringLiteral ( const std::string &  varName) const

Is a variable with the given name global and stores a string literal?

◆ isMainFunc()

bool retdec::llvmir2hll::Module::isMainFunc ( ShPtr< Function func) const

Returns true if the given function is the main function, false otherwise.

The name of the main function depends on the used semantics.

◆ markFuncAsStaticallyLinked()

void retdec::llvmir2hll::Module::markFuncAsStaticallyLinked ( ShPtr< Function func)

Marks the given function as statically linked.

◆ removeFunc()

void retdec::llvmir2hll::Module::removeFunc ( ShPtr< Function func)

Removes the given function from the module.

If there is no matching function, nothing is removed.

◆ removeGlobalVar()

void retdec::llvmir2hll::Module::removeGlobalVar ( ShPtr< Variable var)

Removes the given variable from the module.

If the global variable does not exist, this function does nothing.

Time complexity: O(n), where n is the number of global variables in the module.

Member Data Documentation

◆ config

ShPtr<Config> retdec::llvmir2hll::Module::config
private

The used config.

◆ debugVarNameMap

VarStringMap retdec::llvmir2hll::Module::debugVarNameMap
private

Mapping of a variable into its name in the debug information.

◆ funcs

FuncVector retdec::llvmir2hll::Module::funcs
private

Functions.

◆ globalVars

GlobalVarDefVector retdec::llvmir2hll::Module::globalVars
private

Global variables.

◆ identifier

std::string retdec::llvmir2hll::Module::identifier
private

Identifier of the module.

◆ llvmModule

const llvm::Module* retdec::llvmir2hll::Module::llvmModule
private

Original module from which this module has been created.

◆ semantics

ShPtr<Semantics> retdec::llvmir2hll::Module::semantics
private

The used semantics.


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