dmd.importc
Contains semantic routines specific to ImportC
Specification: C11
License
Source: importc.d
Documentation: https://dlang.org/phobos/dmd_importc.html
-
Declaration
Type
cAdjustParamType
(Typet
, 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
Return Value
adjusted type
-
Declaration
Expression
arrayFuncConv
(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
Expression
e
ImportC expression to possibly convert
Scope*
sc
context
Return Value
converted expression
-
Declaration
Expression
fieldLookup
(Expressione
, Scope*sc
, Identifierid
);Run semantic on
. Expressione
evaluates to an instance of a struct. Look upe
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
Return Value
if successful
if not thene
.identErrorExp
and message is printed -
Declaration
Expression
carraySemantic
(ArrayExpae
, 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
Return Value
Expression if this was a C expression with completed semantic,
null
if not -
Declaration
void
addDefaultCInitializer
(VarDeclarationdsym
);Determine default initializer for const global symbol.
-
Declaration
Expression
castCallAmbiguity
(Expressione
, Scope*sc
);Resolve cast/call grammar ambiguity.
Parameters
Expression
e
expression that might be a cast, might be a call
Scope*
sc
context
Return Value
null
means leave as is, !=null
means rewritten AST -
Declaration
bool
cFuncEquivalence
(TypeFunctiontf1
, TypeFunctiontf2
);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
Return Value
true
if C11 considers them equivalent -
Declaration
bool
cTypeEquivalence
(Typet1
, Typet2
);Types haven't been merged yet, because we haven't done semantic() yet. But we still need to see if
t1
andt2
are the same type.Parameters
Type
t1
first type
Type
t2
second type
Return Value
true
if they are equivalent types