llvm::parseAssemblyFileWithIndex

Parse LLVM Assembly and its module summary from a file.

Synopsis

Declared in <llvm/AsmParser/Parser.h>

ParsedModuleAndIndex
parseAssemblyFileWithIndex(
    StringRef Filename,
    SMDiagnostic& Err,
    LLVMContext& Context,
    SlotMapping* Slots = nullptr,
    DataLayoutCallbackTy DataLayoutCallback = [](StringRef, StringRef) {
      return std::nullopt;
    });

Description

This function is a main interface to the LLVM Assembly Parser. It parses an ASCII file that (presumably) contains LLVM Assembly code, including a module summary. It returns a Module (intermediate representation) and a ModuleSummaryIndex with the corresponding features. Note that this does not verify that the generated Module or Index are valid, so you should run the verifier after parsing the file to check that they are okay.

Return Value

The parsed Module and ModuleSummaryIndex.

Parameters

NameDescription
FilenameThe name of the file to parse
ErrError result info.
ContextContext in which to allocate globals info.
SlotsThe optional slot mapping that will be initialized during parsing.
DataLayoutCallbackOverride datalayout in the llvm assembly.