跳到內容

inheritance

本頁內容尚未翻譯。

def Inheritance.pathWithin (fuel : Nat) (known : List ClassMembers) (x : String) (y : String) : Option (List Nat)

The positions of the base subobjects from a class to one of its bases (empty for the class itself), if it is one; fuel bounds the depth.

def Inheritance.denied (g : Globals Cpp.constructs) (x : String) (y : String) : Option String

Why a class cannot be converted to a base of it here ([conv.ptr]p3, [class.access.base]p4), in clang’s words: the base is more than one subobject of it (paths through one virtual base are one), or it is reached through a base inherited privately or protectedly that the function being checked may not use. None when it can, or is no base.

def Inheritance.publicUnambiguous (all : List ClassMembers) (x : String) (y : String) : Bool

Whether a base of a class is one subobject of it reached through public bases only (a handler for the base catches an exception of the class only then, [except.handle]p3; where the handler is does not matter).

def Inheritance.deniedFor (g : Globals Cpp.constructs) (t : Ty Cpp.constructs) (e : TypedExpr Cpp.constructs) : Option String

Why a value cannot be converted to a type that is a base of its class (or a pointer to one, from a pointer) here.

def Inheritance.path (known : List ClassMembers) (x : String) (y : String) : Option (List Nat)

The path from a class to a base, if it is one.

def Inheritance.subobject (types : TypeExtension Cpp.constructs) (g : Globals Cpp.constructs) (n : NodeId) (object : TypedExpr Cpp.constructs) (path : List Nat) : Option (TypedExpr Cpp.constructs)

The base subobject of an object (an lvalue) along a path: each step the member named for the base’s position (#baseK) of the type the completed struct gives it, or for a virtual base what its pointer #vbp:V points to.

def Inheritance.asBase (types : TypeExtension Cpp.constructs) (g : Globals Cpp.constructs) (n : NodeId) (y : String) (object : TypedExpr Cpp.constructs) : Option (TypedExpr Cpp.constructs)

An object (an lvalue) as its base of a class, if the class is a base of the object’s (none when the object is of that class itself, or the class is no base of it).

def Inheritance.pointer (types : TypeExtension Cpp.constructs) (g : Globals Cpp.constructs) (n : NodeId) (t : Ty Cpp.constructs) (e : TypedExpr Cpp.constructs) : Option (TypedExpr Cpp.constructs)

A pointer to a derived class converted to a pointer to a base ([conv.ptr]p3): the address of the base subobject.

def Inheritance.value (types : TypeExtension Cpp.constructs) (g : Globals Cpp.constructs) (n : NodeId) (t : Ty Cpp.constructs) (e : TypedExpr Cpp.constructs) : Option (TypedExpr Cpp.constructs)

An object of a derived class used as a value of a base class: the base subobject (copied, the rest sliced off).

def Inheritance.cast (types : TypeExtension Cpp.constructs) (checker : Checker Cpp.constructs) (g : Globals Cpp.constructs) (env : Env Cpp.constructs) (e : Expr) : Option (CheckResult Cpp.constructs (Lifted Cpp.constructs))

A pointer to a base class subobject cast to a pointer to a derived class (static_cast<D*>(p) or (D*)p, [expr.static.cast]p11): the object containing it, as many levels up as the path from the derived class to the base; a pointer cast to a pointer to a base, the conversion. None unless the cast is between a class and its base.

def Inheritance.containingCall (types : TypeExtension Cpp.constructs) (checker : Checker Cpp.constructs) (g : Globals Cpp.constructs) (env : Env Cpp.constructs) (n : NodeId) (x : String) (a : Expr) (k : Nat) : Option (CheckResult Cpp.constructs (Lifted Cpp.constructs))

The internal call #containing:X(p, k) a dispatcher makes (Classes.containingCall): the pointer to the complete object of class X containing what p points to, k levels up.

def Address.containing (steps : Nat) (a : Address) : Option Address

The object containing the one an address is at, steps levels up (the path’s last steps dropped).

def Inheritance.containing (evaluator : Evaluator Cpp.constructs) (s : State Cpp.constructs) (n : NodeId) (steps : Nat) (operands : List (TypedExpr Cpp.constructs)) : Evaluated Cpp.constructs Value

The pointer to the object containing the one a pointer points to, steps levels up (a null pointer stays null).