Movatterモバイル変換


[0]ホーム

URL:


D Logo
Menu
Search

Library Reference

version 2.112.0

overview

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 usinga local clone.

dmd.frontend

Contains high-level interfaces for interacting with DMD as a library.
Authors:
Walter Bright
License:
Boost License 1.0

Sourceid.d

Documentationhttps://dlang.org/phobos/dmd_frontend.html

Coveragehttps://codecov.io/gh/dlang/dmd/src/master/compiler/src/dmd/frontend.d

structDiagnostics;
Contains aggregated diagnostics information.
immutable uinterrors;
Number of errors diagnosed
immutable uintwarnings;
Number of warnings diagnosed
boolhasErrors() immutable;
Returns:
true if errors have been diagnosed
boolhasWarnings() immutable;
Returns:
true if warnings have been diagnosed
enumContractChecking: 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
structContractChecks;
Indicates which contracts should be checked or not.
ContractCheckingprecondition;
Precondition checks (in contract).
ContractCheckinginvariant_;
Invariant checks.
ContractCheckingpostcondition;
Postcondition checks (out contract).
ContractCheckingarrayBounds;
Array bound checks.
ContractCheckingassert_;
Assert checks.
ContractCheckingswitchError;
Switch error checks.
voiddeinitializeDMD();
Deinitializes the global variables of the DMD compiler.
This can be used to restore the state set byinitDMD to its original state.Useful if there's a need for multiple sessions of the DMD compiler in the sameapplication.
voidaddImport(const(char)[]path);
Add import path to theglobal.path.
Parameters:
const(char)[]pathimport to add
voidaddStringImport(const(char)[]path);
Add string import path toglobal.filePath.
Parameters:
const(char)[]pathstring import to add
stringfindDMDConfig(const(char)[]dmdFilePath);
Searches for admd.conf.
Parameters:
const(char)[]dmdFilePathpath to the current DMD executable
Returns:
full path to the founddmd.conf,null otherwise.
stringfindLDCConfig(const(char)[]ldcFilePath);
Searches for aldc2.conf.
Parameters:
const(char)[]ldcFilePathpath to the current LDC executable
Returns:
full path to the foundldc2.conf,null otherwise.
stringdetermineDefaultCompiler();
Detect the currently active compiler.
Returns:
full path to the executable of the found compiler,null otherwise.
autoparseImportPathsFromConfig(const(char)[]iniFile, const(char)[]execDir);
Parses admd.conf orldc2.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
autofindImportPaths();
Finds admd.conf and parses it for import paths.This depends on the$DMD environment variable.If$DMD is set toldmd, it will try to detect and parse aldc2.conf instead.
Returns:
A forward range of normalized import paths.
See Also:
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
Returns:
the parsed module object
voidfullSemantic(Modulem);
Run full semantic analysis on a module.
stringprettyPrint(Modulem);
Pretty print a module.
Returns:
Pretty printed module as string.
abstract classDiagnosticReporter;
Interface for diagnostic reporting.
abstract nothrow interrorCount();
Returns:
the number of errors that occurred during lexing or parsing.
abstract nothrow intwarningCount();
Returns:
the number of warnings that occurred during lexing or parsing.
abstract nothrow intdeprecationCount();
Returns:
the number of deprecations that occurred during lexing or parsing.
abstract nothrow boolerror(ref const SourceLocloc, const(char)*format, va_listargs, const(char)*p1, const(char)*p2);
Reports an error message.
Parameters:
SourceLoclocLocation of error
const(char)*formatformat string for error
va_listargsprintf-style variadic arguments
const(char)*p1additional message prefix
const(char)*p2additional message prefix
Returns:
false if the message should also be printed to stderr, true otherwise
abstract nothrow boolerrorSupplemental(ref const SourceLocloc, const(char)*format, va_listargs, const(char)*p1, const(char)*p2);
Reports additional details about an error message.
Parameters:
SourceLoclocLocation of error
const(char)*formatformat string for supplemental message
va_listargsprintf-style variadic arguments
const(char)*p1additional message prefix
const(char)*p2additional message prefix
Returns:
false if the message should also be printed to stderr, true otherwise
abstract nothrow boolwarning(ref const SourceLocloc, const(char)*format, va_listargs, const(char)*p1, const(char)*p2);
Reports a warning message.
Parameters:
SourceLoclocLocation of warning
const(char)*formatformat string for warning
va_listargsprintf-style variadic arguments
const(char)*p1additional message prefix
const(char)*p2additional message prefix
Returns:
false if the message should also be printed to stderr, true otherwise
abstract nothrow boolwarningSupplemental(ref const SourceLocloc, const(char)*format, va_listargs, const(char)*p1, const(char)*p2);
Reports additional details about a warning message.
Parameters:
SourceLoclocLocation of warning
const(char)*formatformat string for supplemental message
va_listargsprintf-style variadic arguments
const(char)*p1additional message prefix
const(char)*p2additional message prefix
Returns:
false if the message should also be printed to stderr, true otherwise
abstract nothrow booldeprecation(ref const SourceLocloc, const(char)*format, va_listargs, const(char)*p1, const(char)*p2);
Reports a deprecation message.
Parameters:
SourceLoclocLocation of the deprecation
const(char)*formatformat string for the deprecation
va_listargsprintf-style variadic arguments
const(char)*p1additional message prefix
const(char)*p2additional message prefix
Returns:
false if the message should also be printed to stderr, true otherwise
abstract nothrow booldeprecationSupplemental(ref const SourceLocloc, const(char)*format, va_listargs, const(char)*p1, const(char)*p2);
Reports additional details about a deprecation message.
Parameters:
SourceLoclocLocation of deprecation
const(char)*formatformat string for supplemental message
va_listargsprintf-style variadic arguments
const(char)*p1additional message prefix
const(char)*p2additional message prefix
Returns:
false if the message should also be printed to stderr, true otherwise
classStderrDiagnosticReporter:dmd.frontend.DiagnosticReporter;
Diagnostic reporter which prints the diagnostic messages to stderr.
This is usually the default diagnostic reporter.
nothrow this(DiagnosticReportinguseDeprecated);
Initializes this object.
Parameters:
DiagnosticReportinguseDeprecatedindicates how deprecation diagnostics should be handled
Copyright © 1999-2026 by theD Language Foundation | Page generated byDdoc on Fri Feb 20 17:56:47 2026

[8]ページ先頭

©2009-2026 Movatter.jp