跳到內容

typed

本頁內容尚未翻譯。

data ParamValue

A detail of a problem (a verdict’s params): text (an integer is written in decimal), or a flag.

data Refusal

Why a program is rejected: a reason in words, or a kind with its details, from which the words are made (Refusal.reason; a host reads the kind and the details, the words are a developer’s log).

def Refusal.textParam (params : List (String * ParamValue)) (key : String) : Option String

The text of the detail named key among params, if they have it as text.

def Refusal.describe (kind : String) (params : List (String * ParamValue)) : String

The words of a structured problem of kind, made from it and its details params alone (the only place they are made). An undeclared name (name; what, which a host reads: variable, function or name; header when a standard header declares it) reads as clang says it, whatever it was used as; the other kinds as Refusal.describeOther.

def Refusal.describeOther (kind : String) (what : String) (params : List (String * ParamValue)) : String

The words of a structured problem other than an undeclared name, by its kind and its what (the other details read from params):

  • notAssignable: what is written to is a const object (const), not an lvalue (rvalue), an array (array), a function (function), or an object of a class whose copy assignment is implicitly deleted (deletedCopy, the class’s name as type);
  • callArguments: too few (tooFew) or too many (tooMany) arguments, or none of the functions named name matches them (noMatch; callee says whether they are functions, member functions or constructors);
  • redeclared: the name declared again, as a variable in the same scope (variable), as a different entity at file scope (entity), as a typedef of another type, a struct or union tag (tag), a function with the same parameters (function; returnType when only its return type differs) or a label;
  • returnValue: a return without a value in a function that returns one (missing), or with one in a void function (unexpected).
def Refusal.typeDetail (params : List (String * ParamValue)) (key : String) : String

The detail named key among params in quotes, as clang writes a type.

def Refusal.operandText (params : List (String * ParamValue)) (side : String) : String

An operator’s operand’s type in quotes (side: left or right), with the type it stands for (leftAlias, rightAlias) where it has one, as clang writes a typedef’s (‘ostream’ (aka ‘basic_ostream’)), from the refusal’s details params.

def Refusal.describeScoped (params : List (String * ParamValue)) : String

The words (clang’s) of a value of a scoped enumeration that does not convert to an arithmetic type (C++ [conv.integral]p1 converts only an unscoped one): by its context (an initialization, a return, else an assignment), the types from and to, and whether the value is an lvalue or an rvalue (value), among the refusal’s details params.

def Refusal.describeConversion (what : String) (name : String) : String

The words of a value that does not convert (noConversion), by its what and the name of the class or enumeration it names: from a pointer, a class or another type to an integer or floating type (pointerToInteger…toFloating), between types, pointers, structs or unions that do not match, from void * without a cast, dropping const, or to an enumeration.

def Refusal.reason (r : Refusal) : String

The words of the refusal r.

def Refusal.undeclared (name : String) (what : String) (header : Option String) : Refusal

An undeclared name: what it was used as (variable, function, or name when it is not known), and the standard header that declares it, if one does.

def Refusal.notAssignable (what : String) (type : Option String) : Refusal

What is written to cannot be: what is const, rvalue, array, function or deletedCopy (with the class’s name as type).

def Refusal.argumentCount (what : String) (name : Option String) (expected : Nat) (got : Nat) : Refusal

A call with too few (what is tooFew) or too many (tooMany) arguments for the function name, when the call names one: how many it takes (expected; the fewest a call may give when the last parameters have defaults) and how many it was given (got).

def Refusal.redeclared (what : String) (name : String) : Refusal

The name declared again: what is variable, entity, typedef, tag, function, returnType or label.

def Refusal.returnValue (what : String) : Refusal

A return that does not fit its function: what is missing (no value in a function that returns one) or unexpected (a value in a void function).

def Refusal.operandTypes (operator : String) (left : String) (right : String) (what : String) : Refusal

A binary operator whose operands’ types do not fit it: the operator as written, the two types left and right as the dialect writes them, and what (pointers: pointer arithmetic with + or -; other).

def Refusal.noConversion (from : String) (to : String) (what : String) (name : Option String) : Refusal

A value of the type from that does not convert to to (both written as the dialect writes them), the way what says (Refusal.describeConversion), with the name of the class or enumeration the words name, if they do.

def Refusal.withCategory (category : String) (r : Refusal) : Refusal

A conversion’s refusal r with whether the value is an lvalue or an rvalue (category), which the words of a scoped enumeration’s say (Refusal.describeScoped); other refusals as they are.

def Refusal.withContext (context : String) (r : Refusal) : Refusal

A conversion’s refusal r with the context it is in (initialization, return), which the words of a scoped enumeration’s say (Refusal.describeScoped); other refusals as they are.

def Refusal.withAliases (left : Option String) (right : Option String) (r : Refusal) : Refusal

An operator’s refusal r with the types its operands’ types stand for, where they do (left, right; a typedef’s: basic_istream<char> for istream), which the words write after them (Refusal.operandText).

def Refusal.withAlias (aka : String) (r : Refusal) : Refusal

An operator’s refusal r with the type its left operand’s type stands for (aka, a typedef’s: basic_ostream<char> for ostream), which the words write after it (Refusal.operandText).

def Refusal.noMatch (callee : String) (name : String) : Refusal

No function named name matches a call’s arguments; callee is function, memberFunction or constructor.

record Constructs

The types of a dialect’s own constructs: tags of types, expressions, statements and allocations, what the dialect adds to the global tables, what it may ask of checking (C++: a template instance), the state of a run, the frames of the machine and the reasons a run stops.

def Constructs.none : Constructs

The constructs of a dialect that adds none (C).

data Stopping (L : Constructs)

Why a run stops or is noted: a behavior the standard leaves open, one of the dialect’s own, or (a note only) a choice the standard leaves to the implementation, made as the reference implementation makes it (its name, such as vector.growth): the verdict holds assuming that choice.

record Target

What a program runs on: the integer and pointer widths, the formats of double and long double, and the choice a verdict assumes when a program uses long double (abi:longDouble.format: its size, alignment and precision are the platform’s, C11 6.2.5p10).

def Target.lp64 : Target

The usual desktop and server target: LP64 as on x86-64 Linux (the System V ABI, glibc), double is binary64 and long double x87’s extended format (16 bytes, aligned to 16, a 64-bit significand).

data Allocation (L : Constructs)

How an object came to exist: a declaration, malloc or calloc, or a way the dialect adds (free must match); or room reserved for an object not yet constructed (the dialect runs nothing before it ends).

def Ty.unqualified {L : Constructs} (t : Ty L) : Ty L

The type without its outermost const.

def FieldTy.isAnonymous {L : Constructs} (field : FieldTy L) : Bool

Whether a member is an anonymous struct or union: one without a name whose type is a struct or union, whose own members are members of the struct or union it is in (C11 6.7.2.1p13, C++17 [class.union.anon]p1). An unnamed bit-field is not one.

def FieldTy.isUnnamedBitField {L : Constructs} (field : FieldTy L) : Bool

Whether a member is an unnamed bit-field (C11 6.7.2.1p12): no initializer or designator names it.

def Ty.isConst {L : Constructs} (t : Ty L) : Bool

Whether the type is const qualified at the outermost level.

def BinaryOp.isArithmetic (op : BinaryOp) : Bool

Whether a binary operator is arithmetic (its result has the operands’ type) rather than a comparison or logical.

def TypedExpr.type {L : Constructs} (p : Platform) (e : TypedExpr L) : Ty L

The type of an expression’s value (an lvalue’s object type, unqualified).

def TypedExpr.node {L : Constructs} (e : TypedExpr L) : NodeId

The node of an expression.

def TypedStmt.node {L : Constructs} (s : TypedStmt L) : NodeId

The node of a statement.

def TypedStmt.referenced {L : Constructs} (s : TypedStmt L) : List String

The functions a statement itself (not the statements inside it) calls or takes the address of.

def TypedStmt.referencedIn {L : Constructs} (ss : List (TypedStmt L)) : List String

The functions statements and the statements inside them call or take the address of.

def TypedStmt.referencedAt {L : Constructs} (ss : List (TypedStmt L)) : List (String * NodeId)

The functions statements and the statements inside them call or take the address of, each with the node of the statement that does.