dmd.frontend
Contains high-level interfaces for interacting with DMD as a library.
License
Source: id.d
Documentation: https://dlang.org/phobos/dmd_frontend.html
-
Declaration
structDiagnostics;Contains aggregated diagnostics information.
-
Declaration
immutable uinterrors;Number of
errorsdiagnosed -
Declaration
immutable uintwarnings;Number of
warningsdiagnosed -
Declaration
immutable boolhasErrors();Return Value
trueif errors have been diagnosed -
Declaration
immutable boolhasWarnings();Return Value
trueif warnings have been diagnosed
-
-
Declaration
enumContractChecking: CHECKENABLE;Indicates the checking state of various contracts.
-
Declaration
default_Initial value
-
Declaration
disabledNever do checking
-
Declaration
enabledAlways do checking
-
Declaration
enabledInSafeOnly do checking in
@safefunctions
-
-
Declaration
structContractChecks;Indicates which contracts should be checked or not.
-
Declaration
ContractCheckingprecondition;Precondition checks (in contract).
-
Declaration
ContractCheckinginvariant_;Invariant checks.
-
Declaration
ContractCheckingpostcondition;Postcondition checks (out contract).
-
Declaration
ContractCheckingarrayBounds;Array bound checks.
-
Declaration
ContractCheckingassert_;Assert checks.
-
Declaration
ContractCheckingswitchError;Switch error checks.
-
-
Declaration
voiddeinitializeDMD();Deinitializes the global variables of the DMD compiler.
Discussion
This can be used to restore the state set by
initDMDto its original state. Useful if there's a need for multiple sessions of the DMD compiler in the same application. -
Declaration
voidaddImport(const(char)[]path);Add import
pathto theglobal..pathParameters
const(char)[]pathimport to add
-
Declaration
voidaddStringImport(const(char)[]path);Add string import
pathtoglobal.filePath.Parameters
const(char)[]pathstring import to add
-
Declaration
stringfindDMDConfig(const(char)[]dmdFilePath);Searches for a
dmd.conf.Parameters
const(char)[]dmdFilePathpath to the current DMD executable
Return Value
full path to the found
dmd.conf,nullotherwise. -
Declaration
stringfindLDCConfig(const(char)[]ldcFilePath);Searches for a
ldc2.conf.Parameters
const(char)[]ldcFilePathpath to the current LDC executable
Return Value
full path to the found
ldc2.conf,nullotherwise. -
Declaration
stringdetermineDefaultCompiler();Detect the currently active compiler.
Return Value
full path to the executable of the found compiler,
nullotherwise. -
Declaration
autoparseImportPathsFromConfig(const(char)[]iniFile, const(char)[]execDir);Parses a
dmd.conforldc2.confconfig file and returns defined import paths.Parameters
const(char)[]iniFileiniFileto parse imports fromconst(char)[]execDirdirectory of the compiler binary
Return Value
forward range of import paths found in
iniFile -
Declaration
autofindImportPaths();Finds a
dmd.confand parses it for import paths. This depends on the$DMDenvironment variable. If$DMDis set toldmd, it will try to detect and parse aldc2.confinstead.Return Value
A forward range of normalized import paths.
See Also
,
-
Declaration
Tuple!(Module, "module_", Diagnostics, "diagnostics")parseModule(AST = ASTCodegen)(const(char)[]fileName, const(char)[]code= null);Parse a module from a string.
Parameters
const(char)[]fileNamefile to parse
const(char)[]codetext to use instead of opening the file
Return Value
the parsed module object
-
Declaration
voidfullSemantic(Modulem);Run full semantic analysis on a module.
-
Declaration
stringprettyPrint(Modulem);Pretty print a module.
Return Value
Pretty printed module as string.
-
Declaration
abstract classDiagnosticReporter;Interface for diagnostic reporting.
-
Declaration
abstract nothrow interrorCount();Return Value
the number of errors that occurred during lexing or parsing.
-
Declaration
abstract nothrow intwarningCount();Return Value
the number of warnings that occurred during lexing or parsing.
-
Declaration
abstract nothrow intdeprecationCount();Return Value
the number of deprecations that occurred during lexing or parsing.
-
Declaration
abstract nothrow boolerror(const ref Locloc, const(char)*format, va_listargs, const(char)*p1, const(char)*p2);Reports an
errormessage.Parameters
LoclocLocation of
errorconst(char)*formatformatstring forerrorva_listargsprintf-style variadic arguments
const(char)*p1additional message prefix
const(char)*p2additional message prefix
Return Value
falseif the message should also be printed to stderr,trueotherwise -
Declaration
abstract nothrow boolerrorSupplemental(const ref Locloc, const(char)*format, va_listargs, const(char)*p1, const(char)*p2);Reports additional details about an error message.
Parameters
LoclocLocation of error
const(char)*formatformatstring for supplemental messageva_listargsprintf-style variadic arguments
const(char)*p1additional message prefix
const(char)*p2additional message prefix
Return Value
falseif the message should also be printed to stderr,trueotherwise -
Declaration
abstract nothrow boolwarning(const ref Locloc, const(char)*format, va_listargs, const(char)*p1, const(char)*p2);Reports a
warningmessage.Parameters
LoclocLocation of
warningconst(char)*formatformatstring forwarningva_listargsprintf-style variadic arguments
const(char)*p1additional message prefix
const(char)*p2additional message prefix
Return Value
falseif the message should also be printed to stderr,trueotherwise -
Declaration
abstract nothrow boolwarningSupplemental(const ref Locloc, const(char)*format, va_listargs, const(char)*p1, const(char)*p2);Reports additional details about a warning message.
Parameters
LoclocLocation of warning
const(char)*formatformatstring for supplemental messageva_listargsprintf-style variadic arguments
const(char)*p1additional message prefix
const(char)*p2additional message prefix
Return Value
falseif the message should also be printed to stderr,trueotherwise -
Declaration
abstract nothrow booldeprecation(const ref Locloc, const(char)*format, va_listargs, const(char)*p1, const(char)*p2);Reports a
deprecationmessage.Parameters
LoclocLocation of the
deprecationconst(char)*formatformatstring for thedeprecationva_listargsprintf-style variadic arguments
const(char)*p1additional message prefix
const(char)*p2additional message prefix
Return Value
falseif the message should also be printed to stderr,trueotherwise -
Declaration
abstract nothrow booldeprecationSupplemental(const ref Locloc, const(char)*format, va_listargs, const(char)*p1, const(char)*p2);Reports additional details about a deprecation message.
Parameters
LoclocLocation of deprecation
const(char)*formatformatstring for supplemental messageva_listargsprintf-style variadic arguments
const(char)*p1additional message prefix
const(char)*p2additional message prefix
Return Value
falseif the message should also be printed to stderr,trueotherwise
-
-
Declaration
classStderrDiagnosticReporter: dmd.frontend.DiagnosticReporter;Diagnostic reporter which prints the diagnostic messages to stderr.
Discussion
This is usually the default diagnostic reporter.
-
Declaration
nothrow this(DiagnosticReportinguseDeprecated);Initializes this object.
Parameters
DiagnosticReportinguseDeprecatedindicates how deprecation diagnostics should be handled
-