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.dsymbolsem
Does the semantic 1 pass on the AST, which looks at symbol declarations but not initializers
or function bodies.
Authors:
License:
Source dsymbolsem.d
Documentation https://dlang.org/phobos/dmd_dsymbolsem.html
- void
dsymbolSemantic(Dsymboldsym, Scope*sc); - Does semantic analysis on the public face of declarations.
- void
addDeferredSemantic(Dsymbols); - Can't run semantic on s now, try again later.
- void
runDeferredSemantic(); - Run semantic() on deferred symbols.
- uinteger_t
size(Dsymbol_this, Locloc); - Returns:SIZE_INVALID when the size cannot be determined
- AlignDeclaration
getAlignment(AlignDeclarationad, Scope*sc); - Determine the numerical value of the AlignmentDeclarationParameters:
AlignDeclaration adAlignmentDeclaration Scope* sccontext Returns:ad with alignment value determined - Dsymbol
toAlias2(Dsymbols); - Resolve recursive tuple expansion in eponymous template.
- Dsymbol
toAlias(Dsymbols); - If this symbol is really an alias for another, return that other. If needed, semantic() is invoked due to resolve forward reference.
- bool
isPOD(StructDeclarationsd); - Determine if struct is POD (Plain Old Data).POD is defined as:
- not nested
- no postblits, destructors, or assignment operators
- no ref fields or fields that are themselves non-POD
Returns:true if struct is POD - bool
fillVtbl(BaseClass*bc, ClassDeclarationcd, FuncDeclarations*vtbl, intnewinstance); - Fill in vtbl[] for base class based on member functions of class cd.
Input bc 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(StructDeclarationsd, CtorDeclarationctor); - Check if ctor is an rvalue constructor. A constructor that receives a single parameter of the same type as Unqual!typeof(this) is an rvalue constructor.Parameters:
StructDeclaration sdstruct that ctor is a member of CtorDeclaration ctorconstructor to test Returns:true if it is an rvalue constructor - Expression
resolveAliasThis(Scope*sc, Expressione, boolgag= false, boolfindOnly= false); - Find the alias this symbol of e's type.Parameters:
Scope* sccontext Expression eexpression forming the this bool gagdo not print errors, return null instead bool findOnlydon't do further processing like resolving properties, i.e. just return plain dotExp() result. Returns:Expression that ise.aliasthis - void
addEnumMembersToSymtab(EnumDeclarationed, Scope*sc, ScopeDsymbolsds); - Add members of EnumDeclaration to the symbol table(s).Parameters:
EnumDeclaration edEnumDeclaration Scope* sccontext of edScopeDsymbol sdssymbol table that edresides in - bool
followInstantiationContext(Dsymbold, Dsymbolp1, Dsymbolp2= null); - Returns true if any of the symbols
p1orp2resides in the enclosing instantiation scope of this. - Dsymbol
toParentP(Dsymbold, Dsymbolp1, Dsymbolp2= null); - Returns the declaration scope scope of this unless any of the symbols
p1orp2resides in its enclosing instantiation scope then the latter is returned. - int
apply(Dsymbolsymbol, int function(Dsymbol, void*)fp, void*ctx); - Iterate this dsymbol or members of this scoped dsymbol, then call
fpwith the found symbol and params.Parameters:Dsymbol symbolthe dsymbol or parent of members to call fp on int function(Dsymbol, void*) fpfunction pointer to process the iterated symbol. If it returns nonzero, the iteration will be aborted. void* ctxcontext 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(AggregateDeclarationad); - Find all instance fields in
ad, then push them into fields.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:AggregateDeclaration adthe AggregateDeclaration to examine Returns:false if any errors occur. - Module
loadCoreStdcConfig(); - A Singleton that loads core.stdc.configReturns:Module of core.stdc.config, null if couldn't find it
- Module
loadStdMath(); - A Singleton that loads std.mathReturns:Module of std.math, null if couldn't find it
- void
adjustLocForMixin(const(char)[]input, Locloc, ref BaseLocbaseLoc, ref OutputmixinOut); - Set up loc for a parse of a mixin. Append the input text to the mixin.Parameters:
const(char)[] inputmixin text Loc loclocation of expansion BaseLoc baseLoclocation to adjust Output mixinOutsink for mixin text data Returns:adjusted loc suitable for Parser - Dsymbol
search(Dsymbold, Locloc, Identifierident, SearchOptFlagsflags= SearchOpt.all); - Search for ident as member of d.Parameters:
Dsymbol ddsymbol where ident is searched for Loc loclocation to print for error messages Identifier identidentifier to search for SearchOptFlags flagssearch options Returns:null if not found - void
setScope(Dsymbold, Scope*sc); - Set scope for future semantic analysis so we can deal better with forward references.Parameters:
Dsymbol ddsymbol for which the scope is set Scope* scscope that is used to set the value - bool
load(Importimp, Scope*sc); - Load module.Returns:true for errors, false for success
- void
checkGNUABITag(Dsymbolsym, LINKlinkage); - Called from a symbol's semantic to check if gnuAbiTag UDA can be applied to themDirectly emits an error if the UDA doesn't work with this symbolParameters:
Dsymbol symsymbol to check for gnuAbiTag LINK linkageLinkage of the symbol (Declaration.link or sc.link) - bool
isGNUABITag(Expressione); - Check if the provided expression references core.attribute.gnuAbiTagThis should be called after semantic has been run on the expression. Semantic on UDA happens in semantic2 (see dmd.semantic2).Parameters:
Expression eExpression to check (usually from UserAttributeDeclaration.atts) Returns:true if the expression references the compiler-recognized gnuAbiTag - bool
determineSize(AggregateDeclarationad, Locloc); - Collect all instance fields, then determine instance size.Returns:false if failed to determine the size.
- bool
oneMember(Dsymbold, out Dsymbolps, Identifierident); - 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(Dsymbold); - Return true if any of the members are static ctors or static dtors, or if any members have members that are.
- bool
_isZeroInit(Expressionexp); - Determine if exp is all binary zeros.Parameters:
Expression expexpression to check Returns:true if it's all binary 0 - bool
hasPointers(Dsymbold); - Is Dsymbol a variable that contains pointers?
- int
_foreach(Scope*sc, Dsymbols*members, scope ForeachDgdg, 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(Modulemod, ref ClassDeclarationsaclasses); - Create array of the local classes in the Module, suitable for inclusion in ModuleInfoParameters:
Module modthe Module ClassDeclarations aclassesarray to fill in Returns:array of local classes - bool
oneMembers(Dsymbols*members, out Dsymbolps, Identifierident); - Same as Dsymbol::oneMember(), but look at an array of Dsymbols.
Copyright © 1999-2026 by the D Language Foundation | Page generated by
Ddoc on Thu Jan 15 22:38:55 2026