Contains high-level interfaces for interacting with DMD as a library.
Contains aggregated diagnostics information.
Number of errors diagnosed
Number of warnings diagnosed
bool
hasErrors() immutable;
Returns:true if errors have been diagnosed
bool
hasWarnings() immutable;
Returns:true if warnings have been diagnosed
enum
ContractChecking: CHECKENABLE;
Indicates the checking state of various contracts.
Initial value
Never do checking
Always do checking
Only do checking in@safe functions
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.
Assert checks.
ContractChecking
switchError;
Switch error checks.
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.
void
addImport(const(char)[]
path);
Add import path to theglobal.path.
Parameters:const(char)[]path | import to add |
void
addStringImport(const(char)[]
path);
Add string import path toglobal.filePath.
Parameters:const(char)[]path | string import to add |
string
findDMDConfig(const(char)[]
dmdFilePath);
Searches for admd.conf.
Parameters:const(char)[]dmdFilePath | path to the current DMD executable |
Returns:full path to the founddmd.conf,null otherwise.
string
findLDCConfig(const(char)[]
ldcFilePath);
Searches for aldc2.conf.
Parameters:const(char)[]ldcFilePath | path to the current LDC executable |
Returns:full path to the foundldc2.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 admd.conf orldc2.conf config file and returns defined import paths.
Parameters:const(char)[]iniFile | iniFile to parse imports from |
const(char)[]execDir | directory of the compiler binary |
Returns:forward range of import paths found ininiFile
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.
Tuple!(Module, "module_", Diagnostics, "diagnostics")
parseModule(AST = ASTCodegen)(const(char)[]
fileName, const(char)[]
code = null);
Parse a module from a string.
Parameters:const(char)[]fileName | file to parse |
const(char)[]code | text to use instead of opening the file |
Returns:the parsed module object
void
fullSemantic(Module
m);
Run full semantic analysis on a module.
string
prettyPrint(Module
m);
Pretty print a module.
Returns:Pretty printed module as string.
abstract class
DiagnosticReporter;
Interface for diagnostic reporting.
abstract nothrow int
errorCount();
Returns:the number of errors that occurred during lexing or parsing.
abstract nothrow int
warningCount();
Returns:the number of warnings that occurred during lexing or parsing.
abstract nothrow int
deprecationCount();
Returns:the number of deprecations that occurred during lexing or parsing.
abstract nothrow bool
error(ref const SourceLoc
loc, const(char)*
format, va_list
args, const(char)*
p1, const(char)*
p2);
Reports an error message.
Parameters:SourceLocloc | Location of error |
const(char)*format | format string for error |
va_listargs | printf-style variadic arguments |
const(char)*p1 | additional message prefix |
const(char)*p2 | additional message prefix |
Returns:false if the message should also be printed to stderr, true otherwise
abstract nothrow bool
errorSupplemental(ref const SourceLoc
loc, const(char)*
format, va_list
args, const(char)*
p1, const(char)*
p2);
Reports additional details about an error message.
Parameters:SourceLocloc | Location of error |
const(char)*format | format string for supplemental message |
va_listargs | printf-style variadic arguments |
const(char)*p1 | additional message prefix |
const(char)*p2 | additional message prefix |
Returns:false if the message should also be printed to stderr, true otherwise
abstract nothrow bool
warning(ref const SourceLoc
loc, const(char)*
format, va_list
args, const(char)*
p1, const(char)*
p2);
Reports a warning message.
Parameters:SourceLocloc | Location of warning |
const(char)*format | format string for warning |
va_listargs | printf-style variadic arguments |
const(char)*p1 | additional message prefix |
const(char)*p2 | additional message prefix |
Returns:false if the message should also be printed to stderr, true otherwise
abstract nothrow bool
warningSupplemental(ref const SourceLoc
loc, const(char)*
format, va_list
args, const(char)*
p1, const(char)*
p2);
Reports additional details about a warning message.
Parameters:SourceLocloc | Location of warning |
const(char)*format | format string for supplemental message |
va_listargs | printf-style variadic arguments |
const(char)*p1 | additional message prefix |
const(char)*p2 | additional message prefix |
Returns:false if the message should also be printed to stderr, true otherwise
abstract nothrow bool
deprecation(ref const SourceLoc
loc, const(char)*
format, va_list
args, const(char)*
p1, const(char)*
p2);
Reports a deprecation message.
Parameters:SourceLocloc | Location of the deprecation |
const(char)*format | format string for the deprecation |
va_listargs | printf-style variadic arguments |
const(char)*p1 | additional message prefix |
const(char)*p2 | additional message prefix |
Returns:false if the message should also be printed to stderr, true otherwise
abstract nothrow bool
deprecationSupplemental(ref const SourceLoc
loc, const(char)*
format, va_list
args, const(char)*
p1, const(char)*
p2);
Reports additional details about a deprecation message.
Parameters:SourceLocloc | Location of deprecation |
const(char)*format | format string for supplemental message |
va_listargs | printf-style variadic arguments |
const(char)*p1 | additional message prefix |
const(char)*p2 | additional message prefix |
Returns:false if the message should also be printed to stderr, true otherwise
class
StderrDiagnosticReporter:
dmd.frontend.DiagnosticReporter;
Diagnostic reporter which prints the diagnostic messages to stderr.
This is usually the default diagnostic reporter.
nothrow this(DiagnosticReporting
useDeprecated);
Initializes this object.
Parameters:DiagnosticReportinguseDeprecated | indicates how deprecation diagnostics should be handled |