sun::moon_bundling::MoonWriter

sun::moon_bundling::MoonWriter

class · Source (opens in a new tab)

class sun::moon_bundling::MoonWriter

Creates .moon bundle files containing multiple modules.

Types

Public Functions

MoonWriter

public · function · Source (opens in a new tab)

sun::moon_bundling::MoonWriter::MoonWriter(std::string bundleHash)

param

  • bundleHash: The bundle's input hash (see driver/input_hash.h), computed before its code was compiled so the compiler could spell every exported symbol with the $hash$_ prefix. Recorded in each module's metadata, for importers and for skipping a build whose inputs are unchanged.

Related: driver/input_hash.h

addModule

public · function · Source (opens in a new tab)

void sun::moon_bundling::MoonWriter::addModule(llvm::Module &module, const moon::ModuleMetadata &metadata)

Add a compiled module to the bundle.

param

  • module: The compiled LLVM module

  • metadata: Module metadata (protobuf) including AST nodes

addNativeArchive

public · function · Source (opens in a new tab)

void sun::moon_bundling::MoonWriter::addNativeArchive(std::string archiveSetHash, std::string name, std::string data)

Carry a native static library inside the bundle.

param

  • archiveSetHash: Hash the archive's symbols are prefixed with

  • name: File name recorded in the bundle (e.g. "libssl.a")

  • data: Raw archive contents, symbols already renamed

getError

public · function · Source (opens in a new tab)

const std::string & sun::moon_bundling::MoonWriter::getError() const

Get error message if write failed.

write

public · function · Source (opens in a new tab)

bool sun::moon_bundling::MoonWriter::write(const std::filesystem::path &outputPath)

Write the bundle to disk.

param

  • outputPath: Path to write the .moon file

return: true on success

Private Fields

blobIndexByModule_

private · variable · Source (opens in a new tab)

std::unordered_map<const llvm::Module*, size_t> sun::moon_bundling::MoonWriter::blobIndexByModule_

No documentation comment.

blobs_

private · variable · Source (opens in a new tab)

std::vector<std::string> sun::moon_bundling::MoonWriter::blobs_

No documentation comment.

bundleHash_

private · variable · Source (opens in a new tab)

std::string sun::moon_bundling::MoonWriter::bundleHash_

No documentation comment.

error_

private · variable · Source (opens in a new tab)

std::string sun::moon_bundling::MoonWriter::error_

No documentation comment.

modules_

private · variable · Source (opens in a new tab)

std::vector<ModuleData> sun::moon_bundling::MoonWriter::modules_

No documentation comment.

Related: ModuleData

nativeArchives_

private · variable · Source (opens in a new tab)

std::vector<PendingArchive> sun::moon_bundling::MoonWriter::nativeArchives_

No documentation comment.

Related: PendingArchive