sun::moon_bundling::MoonReader
class · Source (opens in a new tab)
class sun::moon_bundling::MoonReaderDecodes immutable Moon container bytes; semantic use requires an ABI checker.
Public Functions
- getBitcodeId
- getBytes
- getError
- getLibrary
- getMetadata
- getNativeArchives
- getPath
- getTargetTriple
- hasModule
- listModules
- loadModule
- open
- readNativeArchive
- writeDebugJson
getBitcodeId
public · function · Source (opens in a new tab)
std::string sun::moon_bundling::MoonReader::getBitcodeId(const std::string &moduleKey) constIdentity of the bitcode region backing a module.
Modules that share a code image share this string, so a caller can scan the image once instead of once per module. Empty if the module is unknown.
getBytes
public · function · Source (opens in a new tab)
const std::shared_ptr< const std::string > & sun::moon_bundling::MoonReader::getBytes() constShares immutable container bytes without granting permission to execute them.
getError
public · function · Source (opens in a new tab)
const std::string & sun::moon_bundling::MoonReader::getError() constGet error message if an operation failed.
getLibrary
public · function · Source (opens in a new tab)
const moon::MoonLibrary & sun::moon_bundling::MoonReader::getLibrary() constReturns bundle metadata for inspection, without semantic authorization.
getMetadata
public · function · Source (opens in a new tab)
const moon::ModuleMetadata * sun::moon_bundling::MoonReader::getMetadata(const std::string &moduleKey)Get metadata for a module without loading bitcode.
param
moduleKey: The module key (source hash)
return: Protobuf metadata, or nullptr if not found
getNativeArchives
public · function · Source (opens in a new tab)
const std::vector< NativeArchiveEntry > & sun::moon_bundling::MoonReader::getNativeArchives() constNative static libraries carried by this bundle, in link order.
Related: NativeArchiveEntry
getPath
public · function · Source (opens in a new tab)
const std::filesystem::path & sun::moon_bundling::MoonReader::getPath() constGet the path to this bundle file.
getTargetTriple
public · function · Source (opens in a new tab)
std::string sun::moon_bundling::MoonReader::getTargetTriple()The target the bundle's bitcode was compiled for (LLVM triple), taken from the first module's metadata.
Empty for pre-V4 legacy bundles.
hasModule
public · function · Source (opens in a new tab)
bool sun::moon_bundling::MoonReader::hasModule(const std::string &moduleKey) constChecks whether a module key occurs in the bundle index.
listModules
public · function · Source (opens in a new tab)
std::vector< std::string > sun::moon_bundling::MoonReader::listModules() constList all modules in the bundle.
loadModule
public · function · Source (opens in a new tab)
std::unique_ptr< llvm::Module > sun::moon_bundling::MoonReader::loadModule(const std::string &moduleKey, llvm::LLVMContext &context)Decode a module's LLVM bitcode for inspection.
Semantic consumers must first obtain authorization from AbiCompatibilityChecker. param
-
moduleKey: The module key (source hash) -
context: LLVM context to create module in
return: LLVM module, or nullptr on failure
open
public · function · static · Source (opens in a new tab)
std::unique_ptr< MoonReader > sun::moon_bundling::MoonReader::open(const std::filesystem::path &path)Open a .moon bundle file.
param
path: Path to the .moon file
return: Reader instance, or nullptr on failure
Related: MoonReader
readNativeArchive
public · function · Source (opens in a new tab)
bool sun::moon_bundling::MoonReader::readNativeArchive(const NativeArchiveEntry &entry, std::vector< char > &out)Read one carried archive's bytes for inspection, without ABI authorization.
Entries come from getNativeArchives(); two versions of a library share a file name, so the entry rather than the name identifies one. return: false if the read failed
Related: NativeArchiveEntry, getNativeArchives()
writeDebugJson
public · function · Source (opens in a new tab)
bool sun::moon_bundling::MoonReader::writeDebugJson(const std::filesystem::path &outputPath)Write indented inspection JSON containing module metadata and payload locations, without embedding bitcode or archive bytes.
Returns false and sets getError() if metadata conversion or file output fails.
Related: getError()
Private Functions
MoonReader
private · function · Source (opens in a new tab)
sun::moon_bundling::MoonReader::MoonReader()=defaultCreates an instance with its default state.
readBytes
private · function · Source (opens in a new tab)
bool sun::moon_bundling::MoonReader::readBytes(uint64_t offset, uint64_t size, std::vector< char > &buffer)Read raw bytes from the bundle file.
Private Fields
bundleMetadata_
private · variable · Source (opens in a new tab)
moon::MoonLibrary sun::moon_bundling::MoonReader::bundleMetadata_No documentation comment.
bytes_
private · variable · Source (opens in a new tab)
std::shared_ptr<const std::string> sun::moon_bundling::MoonReader::bytes_No documentation comment.
error_
private · variable · Source (opens in a new tab)
std::string sun::moon_bundling::MoonReader::error_No documentation comment.
indexMap_
private · variable · Source (opens in a new tab)
std::unordered_map<std::string, size_t> sun::moon_bundling::MoonReader::indexMap_No documentation comment.
index_
private · variable · Source (opens in a new tab)
std::vector<ModuleIndexEntry> sun::moon_bundling::MoonReader::index_No documentation comment.
Related: ModuleIndexEntry
nativeArchives_
private · variable · Source (opens in a new tab)
std::vector<NativeArchiveEntry> sun::moon_bundling::MoonReader::nativeArchives_No documentation comment.
Related: NativeArchiveEntry
path_
private · variable · Source (opens in a new tab)
std::filesystem::path sun::moon_bundling::MoonReader::path_No documentation comment.