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.nogc

Checks that a function marked @nogc does not invoke the Garbage Collector.

Specification No-GC Functions

Authors:

Source nogc.d

class NOGCVisitor: dmd.visitor.StoppableVisitor;
Look for GC-allocations
bool setGC(FuncDeclaration fd, Loc loc, const(char)* fmt, RootObject[] args...);
The function is doing something that may allocate with the GC, so mark it as not nogc (not no-how).
Parameters:
FuncDeclaration fd function
Loc loc location of GC action
const(char)* fmt format string for error message. Must include "%s %s" for the function kind and name.
RootObject[] args arguments to format string
Returns:
true if function is marked as @nogc, meaning a user error occurred
bool setGCCall(FuncDeclaration fd, FuncDeclaration f);
The function calls non-@nogc function f, mark it as not nogc.
Parameters:
FuncDeclaration fd function doin the call
FuncDeclaration f function being called
Returns:
true if function is marked as @nogc, meaning a user error occurred