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

Contains semantic routines specific to ImportC

Specification C11

Authors:

Source importc.d

Type cAdjustParamType(Type t, Scope* sc);
C11 does not allow array or function parameters. Hence, adjust those types per C11 6.7.6.3 rules.
Parameters:
Type t parameter type to adjust
Scope* sc context
Returns:
adjusted type
Expression arrayFuncConv(Expression e, Scope* sc);
C11 6.3.2.1-3 Convert expression that is an array of type to a pointer to type. C11 6.3.2.1-4 Convert expression that is a function to a pointer to a function.
Parameters:
Expression e ImportC expression to possibly convert
Scope* sc context
Returns:
converted expression
Expression fieldLookup(Expression e, Scope* sc, Identifier id, bool arrow);
Run semantic on e. Expression e evaluates to an instance of a struct. Look up ident as a field of that struct.
Parameters:
Expression e evaluates to an instance of a struct
Scope* sc context
Identifier id identifier of a field in that struct
bool arrow -> was used
Returns:
if successful e.ident if not then ErrorExp and message is printed
Expression carraySemantic(ArrayExp ae, Scope* sc);
C11 6.5.2.1-2 Apply C semantics to E[I] expression. E1[E2] is lowered to *(E1 + E2)
Parameters:
ArrayExp ae ArrayExp to run semantics on
Scope* sc context
Returns:
Expression if this was a C expression with completed semantic, null if not
void addDefaultCInitializer(VarDeclaration dsym);
Determine default initializer for const global symbol.
Expression castCallAmbiguity(Expression e, Scope* sc);
Resolve cast/call grammar ambiguity.
Parameters:
Expression e expression that might be a cast, might be a call
Scope* sc context
Returns:
null means leave as is, !=null means rewritten AST
bool cFuncEquivalence(TypeFunction tf1, TypeFunction tf2);
Implement the C11 notion of function equivalence, which allows prototyped functions to match K+R functions, even though they are different.
Parameters:
TypeFunction tf1 type of first function
TypeFunction tf2 type of second function
Returns:
true if C11 considers them equivalent
bool cTypeEquivalence(Type t1, Type t2);
Types haven't been merged yet, because we haven't done semantic() yet. But we still need to see if t1 and t2 are the same type.
Parameters:
Type t1 first type
Type t2 second type
Returns:
true if they are equivalent types