LLVM  4.0.0
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 <Linker.h>

Public Types

enum  Flags {
  None = 0, OverrideFromSrc = (1 << 0), LinkOnlyNeeded = (1 << 1), InternalizeLinkedSymbols = (1 << 2),
  DontForceLinkLinkonceODR = (1 << 3)
}
 

Public Member Functions

 Linker (Module &M)
 
bool linkInModule (std::unique_ptr< Module > Src, unsigned Flags=Flags::None, DenseSet< const GlobalValue * > *GlobalsToImport=nullptr)
 Link Src into the composite. More...
 

Static Public Member Functions

static bool linkModules (Module &Dest, std::unique_ptr< Module > Src, unsigned Flags=Flags::None)
 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 24 of file Linker/Linker.h.

Member Enumeration Documentation

Enumerator
None 
OverrideFromSrc 
LinkOnlyNeeded 
InternalizeLinkedSymbols 
DontForceLinkLinkonceODR 

Don't force link referenced linkonce definitions, import declaration.

Definition at line 28 of file Linker/Linker.h.

Constructor & Destructor Documentation

Linker::Linker ( Module M)

Definition at line 604 of file LinkModules.cpp.

Member Function Documentation

bool Linker::linkInModule ( std::unique_ptr< Module Src,
unsigned  Flags = Flags::None,
DenseSet< const GlobalValue * > *  GlobalsToImport = nullptr 
)

Link Src into the composite.

Passing OverrideSymbols as true will have symbols from Src shadow those in the Dest. For ThinLTO function importing/exporting the ModuleSummaryIndex is passed. If GlobalsToImport is provided, only the globals that are part of the set will be imported from the source module.

Returns true on error.

Definition at line 606 of file LinkModules.cpp.

Referenced by llvm::FunctionImporter::importFunctions(), and linkModules().

bool Linker::linkModules ( Module Dest,
std::unique_ptr< Module Src,
unsigned  Flags = Flags::None 
)
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 621 of file LinkModules.cpp.

References L, and linkInModule().

Referenced by LLVMLinkModules2().


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