Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
a local clone.
dmd.frontend
Compiler implementation of the
D programming language.
This module contains high-level interfaces for interacting
with DMD as a library.
Authors:
License:
Source id.d
Documentation https://dlang.org/phobos/dmd_frontend.html
- struct
Diagnostics; - Contains aggregated diagnostics information.
- immutable uint
errors; - Number of errors diagnosed
- immutable uint
warnings; - Number of warnings diagnosed
- immutable bool
hasErrors(); - Returns:true if errors have been diagnosed
- immutable bool
hasWarnings(); - Returns:true if warnings have been diagnosed
- enum
ContractChecking: CHECKENABLE; - Indicates the checking state of various contracts.
default_- Initial value
disabled- Never do checking
enabled- Always do checking
enabledInSafe- Only do checking in @safe functions
- struct
ContractChecks; - Indicates which contracts should be checked or not.
- ContractChecking
precondition; - Precondition checks (in contract).
- ContractChecking
invariant_; - Invariant checks.
- ContractChecking
postcondition; - Postcondition checks (out contract).
- ContractChecking
arrayBounds; - Array bound checks.
- ContractChecking
assert_; - Assert checks.
- ContractChecking
switchError; - Switch error checks.
- void
deinitializeDMD(); - Deinitializes the global variables of the DMD compiler.This can be used to restore the state set by initDMD to its original state. Useful if there's a need for multiple sessions of the DMD compiler in the same application.
- void
addImport(const(char)[]path); - Add import path to the global.
path.Parameters:const(char)[] pathimport to add - void
addStringImport(const(char)[]path); - Add string import path to global.filePath.Parameters:
const(char)[] pathstring import to add - string
findDMDConfig(const(char)[]dmdFilePath); - Searches for a dmd.conf.Parameters:
const(char)[] dmdFilePathpath to the current DMD executable Returns:full path to the found dmd.conf, null otherwise. - string
findLDCConfig(const(char)[]ldcFilePath); - Searches for a ldc2.conf.Parameters:
const(char)[] ldcFilePathpath to the current LDC executable Returns:full path to the found ldc2.conf, null otherwise. - string
determineDefaultCompiler(); - Detect the currently active compiler.Returns:full path to the executable of the found compiler, null otherwise.
- auto
parseImportPathsFromConfig(const(char)[]iniFile, const(char)[]execDir); - Parses a dmd.conf or ldc2.conf config file and returns defined import paths.Parameters:
const(char)[] iniFileiniFile to parse imports from const(char)[] execDirdirectory of the compiler binary Returns:forward range of import paths found ininiFile - auto
findImportPaths(); - Finds a dmd.conf and parses it for import paths. This depends on the $DMD environment variable. If $DMD is set to ldmd, it will try to detect and parse a ldc2.conf instead.Returns:A forward range of normalized import paths.
- Tuple!(Module, "module_", Diagnostics, "diagnostics")
parseModule(AST = ASTCodegen)(const(char)[]fileName, const(char)[]code= null, DiagnosticReporterdiagnosticReporter= defaultDiagnosticReporter); - Parse a module from a string.Parameters:
const(char)[] fileNamefile to parse const(char)[] codetext to use instead of opening the file DiagnosticReporter diagnosticReporterthe diagnostic reporter to use. By default a diagnostic reporter which prints to stderr will be used Returns:the parsed module object - void
fullSemantic(Modulem); - Run full semantic analysis on a module.
- string
prettyPrint(Modulem); - Pretty print a module.Returns:Pretty printed module as string.
Copyright © 1999-2019 by the D Language Foundation | Page generated by
Ddoc on Sun Sep 1 19:49:21 2019