Documentation ¶
Index ¶
- Variables
- func EndOfFile() string
- func EnsureNamespace(arg interface{}) string
- func NewClangFormatter(clangFormatPath string) fidl.Formatter
- func PopNamespace() string
- func PushNamespace() string
- func UseNatural() string
- func UseWire() string
- type Bits
- type BitsMember
- type Const
- type ConstantValue
- type Decl
- type DeclName
- func (dn DeclName) AppendName(suffix string) DeclName
- func (dn DeclName) AppendNamespace(c string) DeclName
- func (dn DeclName) MapNatural(f DeclVariantFunc) DeclName
- func (dn DeclName) MapWire(f DeclVariantFunc) DeclName
- func (dn DeclName) Member(member string) MemberName
- func (dn DeclName) Name() string
- func (dn DeclName) Namespace() Namespace
- func (dn DeclName) PrependName(prefix string) DeclName
- func (dn DeclName) String() string
- func (dn DeclName) TypeName() TypeName
- type DeclVariant
- func (d DeclVariant) AppendName(suffix string) DeclVariant
- func (d DeclVariant) AppendNamespace(part string) DeclVariant
- func (d DeclVariant) DropLastNamespaceComponent() DeclVariant
- func (d DeclVariant) Name() string
- func (d DeclVariant) Namespace() Namespace
- func (d DeclVariant) PrependName(prefix string) DeclVariant
- func (d DeclVariant) String() string
- func (d DeclVariant) Type() TypeVariant
- type DeclVariantFunc
- type Enum
- type EnumMember
- type HandleInformation
- type LLContext
- type LLContextProps
- type LLProps
- type Member
- type MemberName
- type Method
- type Namespace
- type Namespaced
- type Parameter
- type Protocol
- type Result
- type Root
- type Service
- type ServiceMember
- type Struct
- type StructMember
- type Table
- type TableFrameItem
- type TableMember
- type Type
- type TypeName
- type TypeVariant
- type TypeVariantFunc
- type Union
- type UnionMember
Constants ¶
This section is empty.
Variables ¶
var FamilyKinds = namespacedEnum(familyKinds{}).(familyKinds)
FamilyKinds are general categories identifying what operation we should use to pass a value without a move (LLCPP). It also defines the way we should initialize a field.
var Kinds = struct {
Const constKind
Bits bitsKind
Enum enumKind
Protocol protocolKind
Service serviceKind
Struct structKind
Table tableKind
Union unionKind
}{}
var TypeKinds = namespacedEnum(typeKinds{}).(typeKinds)
TypeKinds are the kinds of declarations (arrays, primitives, structs, ...).
Functions ¶
func EnsureNamespace ¶
func EnsureNamespace(arg interface{}) string
EnsureNamespace changes the current namespace to the one supplied and returns the C++ code required to switch to that namespace.
func NewClangFormatter ¶
NewClangFormatter a formatter that invokes clang-format. TODO(fxbug.dev/49757) Use --style=file and copy the .clang-format file to the correct location. An alternate way to do this is to load the config directly from .clang_format and put the style as JSON in quotes.
func PopNamespace ¶
func PopNamespace() string
func PushNamespace ¶
func PushNamespace() string
func UseNatural ¶
func UseNatural() string
Types ¶
type Bits ¶
type Bits struct { fidl.Attributes fidl.Strictness DeclName Type TypeName Mask string MaskName DeclName Members []BitsMember WireAlias DeclVariant // Kind should be default initialized. Kind bitsKind }
type BitsMember ¶
type BitsMember struct { fidl.Attributes Name string Value ConstantValue }
type Const ¶
type Const struct { fidl.Attributes DeclName Extern bool Decorator string Type Type Value ConstantValue // Kind should be default initialized. Kind constKind }
type ConstantValue ¶
func (*ConstantValue) IsSet ¶
func (cv *ConstantValue) IsSet() bool
func (*ConstantValue) String ¶
func (cv *ConstantValue) String() string
type DeclName ¶
type DeclName struct { Natural DeclVariant Wire DeclVariant }
func CommonDeclName ¶
func CommonDeclName(decl DeclVariant) DeclName
CommonDeclName returns a DeclName with the same DeclVariant for both Wire and Natural variants.
func (DeclName) AppendName ¶
AppendName returns a new DeclName with an suffix appended to the name portions.
func (DeclName) AppendNamespace ¶
AppendNamespace returns a new DeclName with additional C++ namespace components appended.
func (DeclName) MapNatural ¶
func (dn DeclName) MapNatural(f DeclVariantFunc) DeclName
func (DeclName) MapWire ¶
func (dn DeclName) MapWire(f DeclVariantFunc) DeclName
func (DeclName) Member ¶
func (dn DeclName) Member(member string) MemberName
func (DeclName) PrependName ¶
PrependName returns a new DeclName with an prefix prepended to the name portions.
type DeclVariant ¶
type DeclVariant struct {
// contains filtered or unexported fields
}
DeclVariant represents the name of a C++ declaration within a namespace.
func NewDeclVariant ¶
func NewDeclVariant(name string, namespace Namespace) DeclVariant
NewDeclVariant creates a new DeclVariant with a name and a namespace.
func (DeclVariant) AppendName ¶
func (d DeclVariant) AppendName(suffix string) DeclVariant
AppendName returns a new DeclVariant with an suffix appended to the name portion.
func (DeclVariant) AppendNamespace ¶
func (d DeclVariant) AppendNamespace(part string) DeclVariant
AppendNamespace returns a new DeclVariant with an additional C++ namespace component appended.
func (DeclVariant) DropLastNamespaceComponent ¶
func (d DeclVariant) DropLastNamespaceComponent() DeclVariant
DropLastNamespaceComponent returns a new DeclVariant with the same name but with the final component of the namespace removed.
func (DeclVariant) Name ¶
func (d DeclVariant) Name() string
func (DeclVariant) Namespace ¶
func (d DeclVariant) Namespace() Namespace
func (DeclVariant) PrependName ¶
func (d DeclVariant) PrependName(prefix string) DeclVariant
PrependName returns a new DeclVariant with an prefix prepended to the name portion.
func (DeclVariant) String ¶
func (d DeclVariant) String() string
func (DeclVariant) Type ¶
func (d DeclVariant) Type() TypeVariant
type DeclVariantFunc ¶
type DeclVariantFunc func(DeclVariant) DeclVariant
DeclVariantFunc is a function that operates over a DeclVariant.
type Enum ¶
type Enum struct { fidl.Attributes fidl.Strictness DeclName Enum fidl.Enum Type TypeName Members []EnumMember WireAlias DeclVariant // Kind should be default initialized. Kind enumKind }
func (*Enum) UnknownValueForTmpl ¶
func (e *Enum) UnknownValueForTmpl() interface{}
type EnumMember ¶
type EnumMember struct { fidl.EnumMember Name string Value ConstantValue }
type HandleInformation ¶
type LLContext ¶
type LLContext int
LLContext indicates where the request/response is used. The allocation strategies differ for client and server contexts.
type LLContextProps ¶
type LLContextProps struct { // Should the request be allocated on the stack, in the managed flavor. StackAllocRequest bool // Should the response be allocated on the stack, in the managed flavor. StackAllocResponse bool // Total number of bytes of stack used for storing the request. StackUseRequest int // Total number of bytes of stack used for storing the response. StackUseResponse int }
LLContextProps contain context-dependent properties of a method specific to llcpp. Context is client (write request and read response) or server (read request and write response).
type LLProps ¶
type LLProps struct { ProtocolName DeclVariant LinearizeRequest bool LinearizeResponse bool ClientContext LLContextProps ServerContext LLContextProps }
LLProps contain properties of a method specific to llcpp
type MemberName ¶
type MemberName struct {
// contains filtered or unexported fields
}
func (MemberName) Decl ¶
func (mn MemberName) Decl() DeclName
func (MemberName) Name ¶
func (mn MemberName) Name() string
type Method ¶
type Method struct { NameInLowerSnakeCase string // The name of a constant that defines the ordinal value. OrdinalName string RequestSize int RequestMaxHandles int RequestMaxOutOfLine int RequestSentMaxSize int RequestPadding bool RequestFlexible bool RequestHasPointer bool RequestIsResource bool ResponseSize int ResponseMaxHandles int ResponseMaxOutOfLine int ResponseSentMaxSize int ResponseReceivedMaxSize int ResponsePadding bool ResponseFlexible bool ResponseHasPointer bool ResponseIsResource bool CallbackType string ResponseHandlerType string ResponderType string LLProps LLProps // contains filtered or unexported fields }
Method should be created using methodInner.build(). TODO: Consider factoring out common fields between Request and Response.
func (*Method) CallbackWrapper ¶
func (*Method) ShouldEmitTypedChannelCascadingInheritance ¶
ShouldEmitTypedChannelCascadingInheritance determines if the code generator should emit two overloads in the server interface API for this method, one with typed channels and the other with regular Zircon channels, during the migration to typed channels in LLCPP. TODO(fxbug.dev/65212): We should always only generate the version with typed channels.
type Namespace ¶
type Namespace []string
Namespace represents a C++ namespace.
func (Namespace) DropLastComponent ¶
DropLastComponent returns a new namespace with the final component removed.
type Namespaced ¶
type Namespaced interface {
Namespace() Namespace
}
Namespaced is implemented by types that have a C++ namespace.
type Parameter ¶
type Parameter struct { Type Type Name string Offset int HandleInformation *HandleInformation }
func (Parameter) NameAndType ¶
type Protocol ¶
type Protocol struct { // OneWayMethods contains the list of one-way (i.e. fire-and-forget) methods // in the protocol. OneWayMethods []Method // TwoWayMethods contains the list of two-way (i.e. has both request and // response) methods in the protocol. TwoWayMethods []Method // ClientMethods contains the list of client-initiated methods (i.e. any // interaction that is not an event). It is the union of one-way and two-way // methods. ClientMethods []Method // Events contains the list of events (i.e. initiated by servers) // in the protocol. Events []Method // Kind should always be default initialized. Kind protocolKind // contains filtered or unexported fields }
Protocol should be created using protocolInner.build().
func (*Protocol) NaturalType ¶
func (*Protocol) ShouldEmitTypedChannelCascadingInheritance ¶
ShouldEmitTypedChannelCascadingInheritance determines if the code generator should emit two versions of the server interface pure virtual class for this protocol, one with typed channels and the other with regular Zircon channels, during the migration to typed channels in LLCPP. TODO(fxbug.dev/65212): We should always only generate the version with typed channels.
type Result ¶
type Result struct { ValueMembers []Parameter ResultDecl DeclName ErrorDecl TypeName ValueDecl TypeVariant ValueStructDecl TypeName ValueTupleDecl TypeVariant }
Holds information about error results on methods
func (Result) ValueArity ¶
type Root ¶
type Root struct { PrimaryHeader string IncludeStem string Headers []string FuzzerHeaders []string HandleTypes []string Library fidl.LibraryIdentifier LibraryReversed fidl.LibraryIdentifier Decls []Decl }
func CompileLibFuzzer ¶
type Service ¶
type Service struct { fidl.Attributes DeclName ServiceName string Members []ServiceMember // Kind should be default initialized. Kind serviceKind }
type ServiceMember ¶
type ServiceMember struct { fidl.Attributes ProtocolType DeclName Name string MethodName string }
type Struct ¶
type Struct struct { fidl.Attributes fidl.Resourceness DeclName TableType string Members []StructMember InlineSize int MaxHandles int MaxOutOfLine int MaxSentSize int HasPadding bool IsResultValue bool HasPointer bool Result *Result WireAlias DeclVariant // Full decls needed to check if a type is memcpy compatible. // Only set if it may be possible for a type to be memcpy compatible, // e.g. has no padding. // See the struct template for usage. FullDeclMemcpyCompatibleDeps []string // Kind should be default initialized. Kind structKind }
type StructMember ¶
type StructMember struct { fidl.Attributes Type Type Name string DefaultValue ConstantValue Offset int HandleInformation *HandleInformation }
func (*StructMember) AsParameter ¶
func (m *StructMember) AsParameter() Parameter
func (StructMember) NameAndType ¶
func (sm StructMember) NameAndType() (string, Type)
type Table ¶
type Table struct { fidl.Attributes fidl.Resourceness DeclName TableType string Members []TableMember InlineSize int BiggestOrdinal int MaxHandles int MaxOutOfLine int MaxSentSize int HasPointer bool WireAlias DeclVariant // FrameItems stores the members in ordinal order; "null" for reserved. FrameItems []TableFrameItem // Kind should be default initialized. Kind tableKind }
type TableFrameItem ¶
type TableFrameItem *TableMember
type TableMember ¶
type TableMember struct { fidl.Attributes Type Type Name string DefaultValue ConstantValue Ordinal int FieldPresenceIsSet string FieldPresenceSet string FieldPresenceClear string FieldDataName string MethodHasName string MethodClearName string ValueUnionName string HandleInformation *HandleInformation }
func (TableMember) NameAndType ¶
func (tm TableMember) NameAndType() (string, Type)
type Type ¶
type Type struct { TypeName WirePointer bool // Defines what operation we should use to pass a value without a move (LLCPP). It also // defines the way we should initialize a field. WireFamily familyKind // NeedsDtor indicates whether this type needs to be destructed explicitely // or not. NeedsDtor bool Kind typeKind IsResource bool DeclarationName fidl.EncodedCompoundIdentifier // Set iff IsArray || IsVector ElementType *Type // Valid iff IsArray ElementCount int }
func (*Type) IsPrimitiveType ¶
IsPrimitiveType returns true if this type is primitive.
func (*Type) WireArgumentDeclaration ¶
WireArgumentDeclaration returns the argument declaration for this type for the wire variant.
func (*Type) WireInitMessage ¶
WireInitMessage returns message field initialization for the wire variant.
func (*Type) WireNoTypedChannels ¶
func (t *Type) WireNoTypedChannels() TypeVariant
WireNoTypedChannels returns the LLCPP declaration when the relevant API would like to opt out of typed channels. TODO(fxbug.dev/65212): Uses of this method should be be replaced by WireDecl.
type TypeName ¶
type TypeName struct { Natural TypeVariant Wire TypeVariant }
TypeName is the name of a type for wire and natural types.
func CommonTypeName ¶
func CommonTypeName(name TypeVariant) TypeName
CommonTypeName returns a TypeName with same name for both natural and wire types.
func PrimitiveTypeName ¶
PrimitiveTypeName returns a TypeName for a primitive type, common across all bindings.
func TypeNameForHandle ¶
func TypeNameForHandle(t fidl.HandleSubtype) TypeName
TypeNameForHandle returns the C++ name for a handle type
func TypeNameForPrimitive ¶
func TypeNameForPrimitive(t fidl.PrimitiveSubtype) TypeName
TypeNameForPrimitive returns the C++ name of a FIDL primitive type.
func (TypeName) MapNatural ¶
func (tn TypeName) MapNatural(f TypeVariantFunc) TypeName
func (TypeName) MapWire ¶
func (tn TypeName) MapWire(f TypeVariantFunc) TypeName
func (TypeName) WithArrayTemplates ¶
WithArrayTemplates wraps type names with templates applications that take integers.
func (TypeName) WithTemplates ¶
WithTemplates wraps type names with template applications.
type TypeVariant ¶
type TypeVariant string
TypeVariant is implemented by something that can be a type name for a particular binding style.
func (TypeVariant) WithArrayTemplate ¶
func (name TypeVariant) WithArrayTemplate(template string, arg int) TypeVariant
WithArrayTemplate wraps a TypeVariant with a template application that takes an integer.
func (TypeVariant) WithTemplate ¶
func (name TypeVariant) WithTemplate(template string) TypeVariant
WithTemplate wraps a TypeVariant with a template application.
type TypeVariantFunc ¶
type TypeVariantFunc func(TypeVariant) TypeVariant
TypeVariantFunc is a function that operates over a TypeVariant.
type Union ¶
type Union struct { fidl.Attributes fidl.Strictness fidl.Resourceness DeclName TableType string Members []UnionMember InlineSize int MaxHandles int MaxOutOfLine int Result *Result HasPointer bool WireAlias DeclVariant // Kind should be default initialized. Kind unionKind }
type UnionMember ¶
type UnionMember struct { fidl.Attributes Ordinal uint64 Type Type Name string StorageName string TagName string Offset int HandleInformation *HandleInformation }
func (UnionMember) NameAndType ¶
func (um UnionMember) NameAndType() (string, Type)
func (UnionMember) UpperCamelCaseName ¶
func (um UnionMember) UpperCamelCaseName() string