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

This class provides the core functionality of linking in LLVM. More...

#include "llvm/Linker/Linker.h"

Public Types

enum  Flags { None = 0 , OverrideFromSrc = (1 << 0) , LinkOnlyNeeded = (1 << 1) }
 

Public Member Functions

 Linker (Module &M)
 
bool linkInModule (std::unique_ptr< Module > Src, unsigned Flags=Flags::None, std::function< void(Module &, const StringSet<> &)> InternalizeCallback={})
 Link Src into the composite.
 

Static Public Member Functions

static bool linkModules (Module &Dest, std::unique_ptr< Module > Src, unsigned Flags=Flags::None, std::function< void(Module &, const StringSet<> &)> InternalizeCallback={})
 This function links two modules together, with the resulting Dest module modified to be the composite of the two input modules.
 

Detailed Description

This class provides the core functionality of linking in LLVM.

It keeps a pointer to the merged module so far. It doesn't take ownership of the module since it is assumed that the user of this class will want to do something with it after the linking.

Definition at line 22 of file Linker.h.

Member Enumeration Documentation

◆ Flags

Enumerator
None 
OverrideFromSrc 
LinkOnlyNeeded 

Definition at line 26 of file Linker.h.

Constructor & Destructor Documentation

◆ Linker()

Linker::Linker ( Module M)

Definition at line 621 of file LinkModules.cpp.

Member Function Documentation

◆ linkInModule()

bool Linker::linkInModule ( std::unique_ptr< Module Src,
unsigned  Flags = Flags::None,
std::function< void(Module &, const StringSet<> &)>  InternalizeCallback = {} 
)

Link Src into the composite.

Passing OverrideSymbols as true will have symbols from Src shadow those in the Dest.

Passing InternalizeCallback will have the linker call the function with the new module and a list of global value names to be internalized by the callback.

Returns true on error.

Definition at line 623 of file LinkModules.cpp.

◆ linkModules()

bool Linker::linkModules ( Module Dest,
std::unique_ptr< Module Src,
unsigned  Flags = Flags::None,
std::function< void(Module &, const StringSet<> &)>  InternalizeCallback = {} 
)
static

This function links two modules together, with the resulting Dest module modified to be the composite of the two input modules.

If an error occurs, true is returned and ErrorMsg (if not null) is set to indicate the problem. Upon failure, the Dest module could be in a modified state, and shouldn't be relied on to be consistent.

Definition at line 640 of file LinkModules.cpp.

Referenced by LLVMLinkModules2().


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