-
A validation error that includes the command’s full help message.
See moreDeclaration
Swift
private struct ValidationErrorWithHelp : Error, CustomStringConvertible, Sendable -
The type of the output files to generate.
See moreDeclaration
Swift
private enum OutputType : String, ExpressibleByArgument, Sendable -
The result of a compiler invocation.
See moreDeclaration
Swift
public struct CompilationResult : Sendable -
Declaration
Swift
public static let configuration: CommandConfiguration -
Undocumented
Declaration
Swift
@Flag private var compileInputAsModules: Bool { get set } -
Undocumented
Declaration
Swift
@Flag private var importBuiltinModule: Bool { get set } -
Undocumented
Declaration
Swift
@Flag private var freestanding: Bool { get set } -
Undocumented
Declaration
Swift
@Flag private var experimentalParallelTypeChecking: Bool { get set } -
Undocumented
Declaration
Swift
@Flag private var typeCheckOnly: Bool { get set } -
Undocumented
Declaration
Swift
@Option private var inferenceTracingSite: SourceLine? { get set } -
Undocumented
Declaration
Swift
@Option private var showRequirementsSite: SourceLine? { get set } -
Undocumented
Declaration
Swift
@Option private var outputType: OutputType { get set } -
Undocumented
Declaration
Swift
@Option private var transforms: ModulePassList? { get set } -
Undocumented
Declaration
Swift
@Option private var librarySearchPaths: [String] { get set } -
Undocumented
Declaration
Swift
@Option private var libraries: [String] { get set } -
Undocumented
Declaration
Swift
@Option private var outputURL: URL? { get set } -
Undocumented
Declaration
Swift
@Flag private var verbose: Bool { get set } -
Undocumented
Declaration
Swift
@Flag private var version: Bool { get set } -
Undocumented
Declaration
Swift
@Flag private var optimize: Bool { get set } -
Undocumented
Declaration
Swift
@Argument private var inputs: [URL] { get set } -
Creates a new instance with default options.
Declaration
Swift
public init() -
The URL of the current working directory.
Declaration
Swift
private var currentDirectory: URL { get } -
Compiles
inputwith the given command line arguments and returns the compiler’s exit status, the URL of the output file, and any diagnostics.Declaration
Swift
public static func compileToTemporary( _ input: URL, withOptions options: [String], extending baseProgram: TypedProgram? = nil ) throws -> CompilationResultParameters
inputThe URL of a single Hylo source file or the root directory of a Hylo module.
optionsThe compiler’s options sans input and output arguments.
baseProgramA program with some or all of the dependencies of the compiler’s input, which have been compiled with options compatible with
options. All dependencies are loaded from disk if this argument isnil -
Executes the command.
Declaration
Swift
public func run() throws -
Executes the command, loading modules into
baseProgramand reporting diagnostics tolog.Declaration
Swift
public func executeCommand( extending baseProgram: TypedProgram? = nil, reportingDiagnosticsTo log: inout DiagnosticSet ) throwsParameters
baseProgramA program with some or all of the dependencies of the compiler’s input, which have been compiled with options compatible with the driver’s current configuration. All dependencies are loaded from disk if this argument is
nillogA set of diagnostics that doesn’t contain any error.
-
Logs
mto the standard error iffverboseistrue.Declaration
Swift
private func logVerbose(_ m: @autoclosure () -> String) -
Returns
trueif type inference related ton, which is inp, would be traced.Declaration
Swift
private func shouldTraceInference(_ n: AnyNodeID, _ p: TypedProgram) -> Bool -
Returns
trueif the requirement system ofn, which is inp, should be logged.Declaration
Swift
private func shouldLogRequirements(_ n: AnyDeclID, _ p: TypedProgram) -> Bool -
Returns
programlowered to Hylo IR, accumulating diagnostics inlogand throwing if an error occurred.Mandatory IR passes are applied unless
self.outputTypeis.rawIR.Declaration
Swift
private func lower( program: TypedProgram, reportingDiagnosticsTo log: inout DiagnosticSet ) throws -> IR.Program -
Returns
m, which isprogram, lowered to Hylo IR, accumulating diagnostics inlogand throwing if an error occurred.Mandatory IR passes are applied unless
self.outputTypeis.rawIR.Declaration
Swift
private func lower( _ m: ModuleDecl.ID, in program: TypedProgram, reportingDiagnosticsTo log: inout DiagnosticSet ) throws -> IR.Module -
Combines the object files located at
objectsinto an executable file atbinaryPath, logging diagnostics tolog.Declaration
Swift
private func makeMacOSExecutable( at binaryPath: String, linking objects: [URL], diagnostics: inout DiagnosticSet ) throws -
Combines the object files located at
objectsinto an executable file atbinaryPath, logging diagnostics tolog.Declaration
Swift
private func makeLinuxExecutable( at binaryPath: String, linking objects: [URL], diagnostics: inout DiagnosticSet ) throws -
Combines the object files located at
objectsinto an executable file atbinaryPath, logging diagnostics tolog.Declaration
Swift
private func makeWindowsExecutable( at binaryPath: String, linking objects: [URL], diagnostics: inout DiagnosticSet ) throws -
Returns
self.outputURLtransformed as a suitable executable file path, usingproductNameas a default name ifoutputURLisnil.Declaration
Swift
private func executableOutputPath(default productName: String) -> String -
If
inputscontains a single URLuwhose path is non-empty, returns the last component ofuwithout any path extension and stripping all leading dots; returns “Main” otherwise.Declaration
Swift
private func makeProductName(_ inputs: [URL]) -> String -
Writes
sourcetourl, possibly with verbose logging.Declaration
Swift
private func write(_ source: String, toURL url: URL) throws -
Creates a module from the contents at
urland adds it to the AST.Requires
urlmust denote a directly.Declaration
Swift
private func addModule(url: URL) -
Returns the path of the binary executable that is invoked at the command-line with the name given by
invocationName.Declaration
Swift
private func findExecutable(invokedAs invocationName: String) throws -> URL -
Runs the executable at
path, passingargumentson the command line, and returns its standard output sans any leading or trailing whitespace.Declaration
Swift
@discardableResult private func runCommandLine( _ programPath: String, _ arguments: [String] = [], diagnostics: inout DiagnosticSet ) throws -> String? -
A map from the name by which an executable is invoked to path of the named binary.
Declaration
Swift
private static let executableLocationCache: SharedMutable<[String : URL]> -
Writes a textual description of
inputto the givenoutputfile.Declaration
Swift
func write(_ input: AST, to output: URL) throws -
Given the desired name of the compiler’s product, returns the file to write when “raw-ast” is selected as the output type.
Declaration
Swift
private func astFile(_ productName: String) -> URL -
Given the desired name of the compiler’s product, returns the file to write when “ir” or “raw-ir” is selected as the output type.
Declaration
Swift
private func irFile(_ productName: String) -> URL -
Given the desired name of the compiler’s product, returns the file to write when “llvm” is selected as the output type.
Declaration
Swift
private func llvmFile(_ productName: String) -> URL -
Given the desired name of the compiler’s product, returns the file to write when “intel-asm” is selected as the output type.
Declaration
Swift
private func intelASMFile(_ productName: String) -> URL -
Given the desired name of the compiler’s product, returns the file to write when “binary” is selected as the output type.
Declaration
Swift
private func binaryFile(_ productName: String) -> URL
View on GitHub