LLVM  6.0.0svn
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. More...
 

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. More...
 

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 25 of file Linker.h.

Member Enumeration Documentation

◆ Flags

Enumerator
None 
OverrideFromSrc 
LinkOnlyNeeded 

Definition at line 29 of file Linker.h.

Constructor & Destructor Documentation

◆ Linker()

Linker::Linker ( Module M)

Definition at line 572 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 574 of file LinkModules.cpp.

Referenced by linkModules().

◆ 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 591 of file LinkModules.cpp.

References linkInModule().

Referenced by LLVMLinkModules2().


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