statics
本頁內容尚未翻譯。
cfamily.Statics.globalName
Section titled “cfamily.Statics.globalName”def Statics.globalName (f : String) (x : DeclId) : DeclIdThe global a static declaration of a function is lifted to: f::x.
cfamily.Statics.lifted
Section titled “cfamily.Statics.lifted”def Statics.lifted (f : String) (d : Stmt) : Option ItemThe global a static declaration of a function is, when it is initialized before the program starts (without an initializer, or with a constant one); none for any other.
cfamily.Statics.nameOf
Section titled “cfamily.Statics.nameOf”def Statics.nameOf (d : Stmt) : Option DeclIdThe declaration a static one is: sDecl or sDeclC, its name.
cfamily.Statics.renamedIn
Section titled “cfamily.Statics.renamedIn”def Statics.renamedIn (f : String) (d : Stmt) : StmtA static declaration of a function declaring its global’s name (C++’s, initialized when first reached).
cfamily.Statics.declared
Section titled “cfamily.Statics.declared”def Statics.declared (f : String) (body : Stmt) : List (DeclId * Option Item)The static declarations in a statement, anywhere inside it: each name, and the global it is lifted to when it is initialized before the program starts.
cfamily.Statics.renamed
Section titled “cfamily.Statics.renamed”def Statics.renamed (f : String) (xs : List DeclId) (e : Expr) : ExprA use of a lifted declaration as its global’s.
cfamily.Statics.ofFunction
Section titled “cfamily.Statics.ofFunction”def Statics.ofFunction (it : Item) (f : String) (body : Stmt) : List ItemA function’s items: the globals of its lifted static declarations, then the function using them.
cfamily.Statics.prepare
Section titled “cfamily.Statics.prepare”def Statics.prepare (items : List Item) : List ItemThe items with every function’s static declarations named as their globals (f::x), the ones initialized before
the program starts lifted to globals.
cfamily.Linkage.unwrapped
Section titled “cfamily.Linkage.unwrapped”def Linkage.unwrapped (it : Item) : ItemAn item without its file-scope static: the program is one translation unit, so internal linkage changes nothing
(C11 6.2.2p3).
cfamily.Linkage.definitionOf
Section titled “cfamily.Linkage.definitionOf”def Linkage.definitionOf (name : String) (items : List Item) : Option DeclIdThe label of the file-scope definition of a variable of a name, if the program has one.
cfamily.Linkage.renamed
Section titled “cfamily.Linkage.renamed”def Linkage.renamed (from : DeclId) (to : DeclId) : SyntaxMapUses of one variable’s label made uses of another’s.
cfamily.Linkage.uses
Section titled “cfamily.Linkage.uses”def Linkage.uses (x : DeclId) (it : Item) : BoolWhether an item uses a variable’s label.
cfamily.Linkage.prepare
Section titled “cfamily.Linkage.prepare”def Linkage.prepare (items : List Item) : List ItemThe program’s items with file-scope static and extern settled: a static item is the item itself; an extern
declaration declares the variable’s definition (its uses are uses of the definition’s label, and it stays where it is
written, so what comes between it and a later definition sees the variable). One with no definition stays when
something uses it (the checker rejects it: C11 6.9p5), and goes when nothing does.
cfamily.BlockTypes.Renames
Section titled “cfamily.BlockTypes.Renames”def BlockTypes.Renames : TypeThe block’s types defined so far: each name (and whether it is a tag) and its new name.
cfamily.BlockTypes.key
Section titled “cfamily.BlockTypes.key”def BlockTypes.key (d : TypeDefinition) : String * BoolA type defined in a block: its name, and whether it is a tag (struct, union and enum tags share one name space; a typedef’s name is an ordinary identifier, C11 6.2.3).
cfamily.BlockTypes.named
Section titled “cfamily.BlockTypes.named”def BlockTypes.named (to : String) (d : TypeDefinition) : TypeDefinitionA type defined in a block under another name.
cfamily.BlockTypes.retyped
Section titled “cfamily.BlockTypes.retyped”def BlockTypes.retyped (key : String * Bool) (to : String) (t : TypeSyntax) : TypeSyntaxA written type naming a block’s type by its old name, named by the new one.
cfamily.BlockTypes.nameFor
Section titled “cfamily.BlockTypes.nameFor”def BlockTypes.nameFor (defined : BlockTypes.Renames) (n : NodeId) (key : String * Bool) : StringThe name a block’s type gets at file scope: its own and its node (P#n); a second definition in the same block
gets the first one’s, so that it is a redefinition at file scope too (6.7.2.3p1, 6.7p3).
cfamily.BlockTypes.retypedAll
Section titled “cfamily.BlockTypes.retypedAll”def BlockTypes.retypedAll (defined : BlockTypes.Renames) (t : TypeSyntax) : TypeSyntaxA written type with the block’s types defined so far named by their new names.
cfamily.BlockTypes.renaming
Section titled “cfamily.BlockTypes.renaming”def BlockTypes.renaming (defined : BlockTypes.Renames) : SyntaxMapRenaming the block’s types defined so far.
cfamily.BlockTypes.inSequenceWith
Section titled “cfamily.BlockTypes.inSequenceWith”def BlockTypes.inSequenceWith (defined : BlockTypes.Renames) (xs : List Stmt) : BlockTypes.Renames * List StmtA block’s statements in order with the types defined so far renamed: a type defined among them gets its new name, and the statements after it use it (a tag’s scope starts at its tag, so a struct’s members may point to it; a typedef’s at the end of its declarator, C11 6.2.1p7). Also the types defined so far, with the block’s own.
cfamily.BlockTypes.inSequence
Section titled “cfamily.BlockTypes.inSequence”def BlockTypes.inSequence (defined : BlockTypes.Renames) (xs : List Stmt) : List StmtA block’s statements with its types named.
cfamily.BlockTypes.inClauses
Section titled “cfamily.BlockTypes.inClauses”def BlockTypes.inClauses (defined : BlockTypes.Renames) (cs : List Clause) : List ClauseA switch’s clauses as one block (its body is one, C11 6.8.4.2): a type defined in one clause is in scope in the clauses after it.
cfamily.BlockTypes.defines
Section titled “cfamily.BlockTypes.defines”def BlockTypes.defines (s : Stmt) : BoolWhether a statement defines a type.
cfamily.BlockTypes.item
Section titled “cfamily.BlockTypes.item”def BlockTypes.item (d : TypeDefinition) : ItemThe file-scope item a block’s type becomes.
cfamily.BlockTypes.left
Section titled “cfamily.BlockTypes.left”def BlockTypes.left (s : Stmt) : StmtA block’s type, once moved to file scope, does nothing where it is written.
cfamily.BlockTypes.ofFunction
Section titled “cfamily.BlockTypes.ofFunction”def BlockTypes.ofFunction (it : Item) (d : FunctionDefinition) : List ItemThe types a function defines in its blocks, renamed, as file-scope items before it (in the order written); none for a function that defines none.
cfamily.BlockTypes.prepare
Section titled “cfamily.BlockTypes.prepare”def BlockTypes.prepare (items : List Item) : List ItemThe items with the types each function defines in its blocks moved to file scope before it, named after their
nodes (P#n): a name’s scope is its block, so the innermost definition before a use is the one it names.
cfamily.Bindings.hidden
Section titled “cfamily.Bindings.hidden”def Bindings.hidden (n : NodeId) : DeclIdThe object a structured binding decomposes: #bound: and its node.
cfamily.Bindings.parts
Section titled “cfamily.Bindings.parts”def Bindings.parts (n : NodeId) (whole : Expr) (count : Nat) (k : Nat) (names : List Binder) : List StmtEach name of a structured binding as a reference to its part of the object, from the k-th on.
cfamily.Bindings.expanded
Section titled “cfamily.Bindings.expanded”def Bindings.expanded (s : Stmt) : List StmtA structured binding as the declarations it is: the object (auto copies it, auto & refers to it; shown as a name so it is not a temporary), then each name a reference to its part ([dcl.struct.bind]p1, p3). A range for over one declares them first in its body.
cfamily.Bindings.prepare
Section titled “cfamily.Bindings.prepare”def Bindings.prepare (items : List Item) : List ItemThe items with each function’s structured bindings expanded in its blocks.
cfamily.Compounds.name
Section titled “cfamily.Compounds.name”def Compounds.name (n : NodeId) : DeclIdThe object a compound literal is: #c: and its node.
cfamily.Compounds.in
Section titled “cfamily.Compounds.in”def Compounds.in (e : Expr) : List (NodeId * (TypeSyntax * Init))The compound literals in an expression, outside in: each node, type and initializer.
cfamily.Compounds.literal
Section titled “cfamily.Compounds.literal”def Compounds.literal (e : Expr) : BoolWhether an expression is a compound literal.
cfamily.Compounds.has
Section titled “cfamily.Compounds.has”def Compounds.has (e : Expr) : BoolWhether an expression has a compound literal.
cfamily.Compounds.effect
Section titled “cfamily.Compounds.effect”def Compounds.effect (e : Expr) : BoolWhether an expression may change something or read input (calls, assignments, increments, C++’s new and input).
cfamily.Compounds.sequenced
Section titled “cfamily.Compounds.sequenced”def Compounds.sequenced (e : Expr) : BoolWhether an operand of a sequencing operator (,, &&, ||, ?:) has a compound literal: declared before the
statement, its initializer would be evaluated before the operands that come first.
cfamily.Compounds.movable
Section titled “cfamily.Compounds.movable”def Compounds.movable (es : List Expr) : BoolWhether the compound literals of a statement’s expressions may be declared before it: their initializers have no effects (so their values depend only on the state before the statement; an unsequenced read and write in one full expression is undefined anyway, C11 6.5p2) and none is an operand a sequencing operator may evaluate later.
cfamily.Compounds.named
Section titled “cfamily.Compounds.named”def Compounds.named : SyntaxMapA compound literal’s uses as its object’s.
cfamily.Compounds.declarations
Section titled “cfamily.Compounds.declarations”def Compounds.declarations (es : List Expr) : List StmtThe declarations of the compound literals of expressions, the inner ones first (an outer one’s initializer uses them; their order is otherwise unobservable, as their initializers have no effects).
cfamily.Compounds.inStatement
Section titled “cfamily.Compounds.inStatement”def Compounds.inStatement (s : Stmt) : List StmtA statement of a block with its compound literals declared before it (each lives to the end of the block, C11 6.5.2.5p5); a selection statement, and a for, is a block of its own (6.8.4p3, 6.8.5p5), so it is put in a block with them. One whose compound literals cannot move is left as it is.
cfamily.Compounds.prepare
Section titled “cfamily.Compounds.prepare”def Compounds.prepare (items : List Item) : List ItemThe items with each function’s compound literals declared before their statements; a file-scope variable’s initializer’s as file-scope objects before it (static storage, 6.5.2.5p5).
cfamily.Statics.isLifted
Section titled “cfamily.Statics.isLifted”def Statics.isLifted (d : Stmt) : BoolWhether a static declaration was lifted (its block’s statement does nothing).