dmd.importc
Contains semantic routines specific to ImportC
Specification: C11
License
Source: importc.d
Documentation: https://dlang.org/phobos/dmd_importc.html
-
Declaration
TypecAdjustParamType(Typet, Scope*sc);C11 does not allow array or function parameters. Hence, adjust those types per C11 6.7.6.3 rules.
Parameters
Typetparameter type to adjust
Scope*sccontext
Return Value
adjusted type
-
Declaration
ExpressionarrayFuncConv(Expressione, 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
ExpressioneImportC expression to possibly convert
Scope*sccontext
Return Value
converted expression
-
Declaration
ExpressionfieldLookup(Expressione, Scope*sc, Identifierid);Run semantic on
. Expressioneevaluates to an instance of a struct. Look upeidentas a field of that struct.Parameters
Expressioneevaluates to an instance of a struct
Scope*sccontext
Identifierididentifier of a field in that struct
Return Value
if successful
if not thene.identErrorExpand message is printed -
Declaration
ExpressioncarraySemantic(ArrayExpae, Scope*sc);C11 6.5.2.1-2 Apply C semantics to
E[I]expression. E1[E2] is lowered to *(E1 + E2)Parameters
ArrayExpaeArrayExp to run semantics on
Scope*sccontext
Return Value
Expression if this was a C expression with completed semantic,
nullif not -
Declaration
voidaddDefaultCInitializer(VarDeclarationdsym);Determine default initializer for const global symbol.
-
Declaration
ExpressioncastCallAmbiguity(Expressione, Scope*sc);Resolve cast/call grammar ambiguity.
Parameters
Expressioneexpression that might be a cast, might be a call
Scope*sccontext
Return Value
nullmeans leave as is, !=nullmeans rewritten AST -
Declaration
boolcFuncEquivalence(TypeFunctiontf1, TypeFunctiontf2);Implement the C11 notion of function equivalence, which allows prototyped functions to match K+R functions, even though they are different.
Parameters
TypeFunctiontf1type of first function
TypeFunctiontf2type of second function
Return Value
trueif C11 considers them equivalent -
Declaration
boolcTypeEquivalence(Typet1, Typet2);Types haven't been merged yet, because we haven't done semantic() yet. But we still need to see if
t1andt2are the same type.Parameters
Typet1first type
Typet2second type
Return Value
trueif they are equivalent types