sun::moon_bundling::ModuleLinker
class · Source (opens in a new tab)
class sun::moon_bundling::ModuleLinkerLinks precompiled .moon modules into a target LLVM module.
Public Functions
- ModuleLinker
- declareAvailableFunctions
- getError
- getLinkedModules
- linkModule
- linkModules
- linkOnlyUsedSymbols
- registerAvailableBundle
- registerAvailableModules
ModuleLinker
public · function · Source (opens in a new tab)
sun::moon_bundling::ModuleLinker::ModuleLinker(llvm::Module &targetModule)Create a linker for the given target module.
param
targetModule: The module to link into
declareAvailableFunctions
public · function · Source (opens in a new tab)
void sun::moon_bundling::ModuleLinker::declareAvailableFunctions()Declare all exported functions as external declarations in target module This allows codegen to reference functions before actual linking, and records which module defines each symbol for linkOnlyUsedSymbols() Must call registerAvailableModules() first.
Related: linkOnlyUsedSymbols(), registerAvailableModules()
getError
public · function · Source (opens in a new tab)
const std::string & sun::moon_bundling::ModuleLinker::getError() constGet error message if linking failed.
getLinkedModules
public · function · Source (opens in a new tab)
const std::set< std::string > & sun::moon_bundling::ModuleLinker::getLinkedModules() constGet list of successfully linked modules.
linkModule
public · function · Source (opens in a new tab)
bool sun::moon_bundling::ModuleLinker::linkModule(const std::string &moduleKey)Link a precompiled module by module key (source hash).
param
moduleKey: The module key (source hash)
return: true on success
linkModules
public · function · Source (opens in a new tab)
bool sun::moon_bundling::ModuleLinker::linkModules(const std::vector< std::string > &moduleKeys)Link multiple modules, resolving dependencies transitively.
param
moduleKeys: List of module keys
return: true if all modules linked successfully
linkOnlyUsedSymbols
public · function · Source (opens in a new tab)
bool sun::moon_bundling::ModuleLinker::linkOnlyUsedSymbols()Link only the modules needed to resolve undefined symbols in target Must call declareAvailableFunctions() first.
return: true on success
Related: declareAvailableFunctions()
registerAvailableBundle
public · function · Source (opens in a new tab)
void sun::moon_bundling::ModuleLinker::registerAvailableBundle(const MoonImport &moonImport)Register a bundle's original compiled symbols; aliases are source-only.
Related: MoonImport
registerAvailableModules
public · function · Source (opens in a new tab)
void sun::moon_bundling::ModuleLinker::registerAvailableModules(const std::vector< std::string > &moduleKeys)Register available modules without linking their bitcode.
Which symbols each provides is learned by declareAvailableFunctions(). param
moduleKeys: List of module keys to make available
Related: declareAvailableFunctions()
Private Functions
linkModuleRecursive
private · function · Source (opens in a new tab)
bool sun::moon_bundling::ModuleLinker::linkModuleRecursive(const std::string &moduleKey)Link a module and its dependencies recursively.
Private Fields
availableModules_
private · variable · Source (opens in a new tab)
std::set<std::string> sun::moon_bundling::ModuleLinker::availableModules_No documentation comment.
error_
private · variable · Source (opens in a new tab)
std::string sun::moon_bundling::ModuleLinker::error_No documentation comment.
linkedContentHashes_
private · variable · Source (opens in a new tab)
std::set<std::string> sun::moon_bundling::ModuleLinker::linkedContentHashes_No documentation comment.
linkedModules_
private · variable · Source (opens in a new tab)
std::set<std::string> sun::moon_bundling::ModuleLinker::linkedModules_No documentation comment.
scanContext_
private · variable · Source (opens in a new tab)
std::unique_ptr<llvm::LLVMContext> sun::moon_bundling::ModuleLinker::scanContext_No documentation comment.
symbolToModule_
private · variable · Source (opens in a new tab)
std::unordered_map<std::string, std::string> sun::moon_bundling::ModuleLinker::symbolToModule_No documentation comment.
target_
private · variable · Source (opens in a new tab)
llvm::Module& sun::moon_bundling::ModuleLinker::target_No documentation comment.