Does the semantic 1 pass on the AST, which looks at symbol declarations but not initializers or function bodies.
void
dsymbolSemantic(Dsymbol
dsym, Scope*
sc);
Does semantic analysis on the public face of declarations.
void
addDeferredSemantic(Dsymbol
s);
Can't run semantic on s now, try again later.
void
runDeferredSemantic();
Run semantic() on deferred symbols.
uinteger_t
size(Dsymbol
_this, Loc
loc);
Returns:SIZE_INVALID when the size cannot be determined
AlignDeclaration
getAlignment(AlignDeclaration
ad, Scope*
sc);
Determine the numerical value of the AlignmentDeclaration
Parameters:AlignDeclarationad | AlignmentDeclaration |
Scope*sc | context |
Returns:ad with alignment value determined
Dsymbol
toAlias2(Dsymbol
s);
Resolve recursive tuple expansion in eponymous template.
Dsymbol
toAlias(Dsymbol
s);
If this symbol is really an alias for another, return that other. If needed, semantic() is invoked due to resolve forward reference.
bool
isPOD(StructDeclaration
sd);
Determine if struct is POD (Plain Old Data).
POD is defined as:
- not nested
- no postblits, destructors, or assignment operators
- noref fields or fields that are themselves non-POD
The idea being these are compatible with C structs.
Returns:true if struct is POD
bool
fillVtbl(BaseClass*
bc, ClassDeclaration
cd, FuncDeclarations*
vtbl, int
newinstance);
Fill in vtbl[] for base class based on member functions of class cd.
Inputbc BaseClass vtbl if !=NULL, fill it in newinstance !=0 means all entries must be filled in by members of cd, not members of any base classes of cd.
Returns:true if any entries were filled in by members of cd (not exclusively by base classes)
bool
isRvalueConstructor(StructDeclaration
sd, CtorDeclaration
ctor);
Check if ctor is an rvalue constructor. A constructor that receives a single parameter of the same type asUnqual!typeof(this) is an rvalue constructor.
Parameters:StructDeclarationsd | struct that ctor is a member of |
CtorDeclarationctor | constructor to test |
Returns:true if it is an rvalue constructor
Expression
resolveAliasThis(Scope*
sc, Expression
e, bool
gag = false, bool
findOnly = false);
Find thealias this symbol of e's type.
Parameters:Scope*sc | context |
Expressione | expression forming thethis |
boolgag | do not print errors, returnnull instead |
boolfindOnly | don't do further processing like resolving properties, i.e. just return plain dotExp() result. |
Returns:Expression that ise.aliasthis
void
addEnumMembersToSymtab(EnumDeclaration
ed, Scope*
sc, ScopeDsymbol
sds);
Add members of EnumDeclaration to the symbol table(s).
Parameters:EnumDeclarationed | EnumDeclaration |
Scope*sc | context ofed |
ScopeDsymbolsds | symbol table thated resides in |
bool
followInstantiationContext(Dsymbol
d, Dsymbol
p1, Dsymbol
p2 = null);
Returns true if any of the symbolsp1 orp2 resides in the enclosing instantiation scope ofthis.
Dsymbol
toParentP(Dsymbol
d, Dsymbol
p1, Dsymbol
p2 = null);
Returns the declaration scope scope ofthis unless any of the symbolsp1 orp2 resides in its enclosing instantiation scope then the latter is returned.
int
apply(Dsymbol
symbol, int function(Dsymbol, void*)
fp, void*
ctx);
Iterate this dsymbol or members of this scoped dsymbol, then callfp with the found symbol andparams.
Parameters:Dsymbolsymbol | the dsymbol or parent of members to call fp on |
int function(Dsymbol, void*)fp | function pointer to process the iterated symbol. If it returns nonzero, the iteration will be aborted. |
void*ctx | context parameter passed to fp. |
Returns:nonzero if the iteration is aborted by the return value of fp, or 0 if it's completed.
bool
determineFields(AggregateDeclaration
ad);
Find all instance fields inad, then push them intofields.
Runs semantic() for all instance field variables, but also the field types can remain yet not resolved forward references, except direct recursive definitions. After the process sizeok is set to Sizeok.fwd.
Parameters:AggregateDeclarationad | the AggregateDeclaration to examine |
Returns:false if any errors occur.
Module
loadCoreStdcConfig();
A Singleton that loads core.stdc.config
Returns:Module of core.stdc.config, null if couldn't find it
A Singleton that loads std.math
Returns:Module of std.math, null if couldn't find it
void
adjustLocForMixin(const(char)[]
input, Loc
loc, ref BaseLoc
baseLoc, ref Output
mixinOut);
Set up loc for a parse of a mixin. Append the input text to the mixin.
Parameters:const(char)[]input | mixin text |
Locloc | location of expansion |
BaseLocbaseLoc | location to adjust |
OutputmixinOut | sink for mixin text data |
Returns:adjusted loc suitable for Parser
Dsymbol
search(Dsymbol
d, Loc
loc, Identifier
ident, SearchOptFlags
flags = SearchOpt.all);
Search for ident as member of d.
Parameters:Dsymbold | dsymbol where ident is searched for |
Locloc | location to print for error messages |
Identifierident | identifier to search for |
SearchOptFlagsflags | search options |
Returns:null if not found
void
setScope(Dsymbol
d, Scope*
sc);
Set scope for future semantic analysis so we can deal better with forward references.
Parameters:Dsymbold | dsymbol for which the scope is set |
Scope*sc | scope that is used to set the value |
bool
load(Import
imp, Scope*
sc);
Load module.
Returns:true for errors, false for success
void
checkGNUABITag(Dsymbol
sym, LINK
linkage);
Called from a symbol's semantic to check ifgnuAbiTag UDA can be applied to them
Directly emits an error if the UDA doesn't work with this symbol
Parameters:Dsymbolsym | symbol to check forgnuAbiTag |
LINKlinkage | Linkage of the symbol (Declaration.link or sc.link) |
bool
isGNUABITag(Expression
e);
Check if the provided expression referencescore.attribute.gnuAbiTag
This should be called after semantic has been run on the expression. Semantic on UDA happens in semantic2 (seedmd.semantic2).
Parameters:Expressione | Expression to check (usually fromUserAttributeDeclaration.atts) |
Returns:true if the expression references the compiler-recognizedgnuAbiTag
bool
determineSize(AggregateDeclaration
ad, Loc
loc);
Collect all instance fields, then determine instance size.
Returns:false if failed to determine the size.
bool
oneMember(Dsymbol
d, out Dsymbol
ps, Identifier
ident);
Determine if this symbol is only one.
Returns:false, ps = null: There are 2 or more symbols true, ps = null: There are zero symbols true, ps = symbol: The one and only one symbol
bool
hasStaticCtorOrDtor(Dsymbol
d);
Return true if any of the members are static ctors or static dtors, or if any members have members that are.
bool
_isZeroInit(Expression
exp);
Determine if exp is all binary zeros.
Parameters:Expressionexp | expression to check |
Returns:true if it's all binary 0
bool
hasPointers(Dsymbol
d);
Is Dsymbol a variable that contains pointers?
int
_foreach(Scope*
sc, Dsymbols*
members, scope ForeachDg
dg, size_t*
pn = null);
Expands attribute declarations in members in depth first order. Calls dg(size_t symidx, Dsymbol *sym) for each member. If dg returns !=0, stops and returns that value else returns 0. Use this function to avoid the O(N + N^2/2) complexity of calculating dim and calling N times getNth.
Returns:last value returned by dg()
void
getLocalClasses(Module
mod, ref ClassDeclarations
aclasses);
Create array of the local classes in the Module, suitable for inclusion in ModuleInfo
Parameters:Modulemod | the Module |
ClassDeclarationsaclasses | array to fill in |
Returns:array of local classes
bool
oneMembers(Dsymbols*
members, out Dsymbol
ps, Identifier
ident);
Same as Dsymbol::oneMember(), but look at an array of Dsymbols.