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.


Also used to convert AST nodes to D code in general, e.g. for error messages or printf debugging.

Source hdrgen.d

void genhdrfile(Module m, bool doFuncBodies, ref OutBuffer buf);
Generate a header (.di) file for Module m.
Module m Module to generate header for
bool doFuncBodies generate function definitions rather than just declarations
OutBuffer buf buffer to write the data to
const(char)* toChars(const Statement s);
Turn a Statement into a string suitable for printf. Leaks memory.
Statement s Statement to convert
0-terminated string
void moduleToBuffer(ref OutBuffer buf, bool vcg_ast, Module m);
Dumps the full contents of module m to buf.
OutBuffer buf buffer to write to.
bool vcg_ast write out codegen ast
Module m module to visit all members of.
void floatToBuffer(Type type, const real_t value, ref OutBuffer buf, const bool allowHex);
Formats value as a literal of type type into buf.
Type type literal type (e.g. Tfloat)
real_t value value to print
OutBuffer buf target buffer
bool allowHex whether hex floating point literals may be used for greater accuracy
@safe string stcToString(ref StorageClass stc);
Pick off one of the storage classes from stc, and return a string representation of it. stc is reduced by the one picked.
const(char)* visibilityToChars(Visibility.Kind kind);

pure nothrow @safe string visibilityToString(Visibility.Kind kind);
a human readable representation of kind
void argExpTypesToCBuffer(ref OutBuffer buf, Expressions* arguments);
Write out argument types to buf.
const(char)* parametersTypeToChars(ParameterList pl);
Pretty print function parameters.
ParameterList pl parameter list to print
Null-terminated string representing parameters.
const(char)* parameterToChars(Parameter parameter, TypeFunction tf, bool fullQual);
Pretty print function parameter.
Parameter parameter parameter to print.
TypeFunction tf TypeFunction which holds parameter.
bool fullQual whether to fully qualify types.
Null-terminated string representing parameters.
string EXPtoString(EXP op);
Convert EXP to char*.