Namespaces

Enumerations

enum class ExperimentalFlag : uint8_t
Name Value Comments
kAllowNewTypes 1 << 0

Enable the experimental RFC-0052 newtype implementation.
TODO(https://fxbug.dev/42158155): Finish newtypes.

kOutputIndexJson 1 << 1

Write
<name
>.index.json alongside the
<name
>.json IR.
TODO(https://fxbug.dev/42055022): Stabilize Kythe index JSON output.

kZxCTypes 1 << 2

Enable the experimental Zircon C types for the Zither project.
TODO(https://fxbug.dev/42061412): Stabilize experimental zx C types.

kAllowArbitraryErrorTypes 1 << 3

Allow any types in error syntax, not just (u)int32 or enums thereof.
TODO(https://fxbug.dev/42052574): Currently for FDomain. Remove when allowed everywhere.

kNoResourceAttribute 1 << 4

Allow use of the
attribute.

Flags for experimental compiler features, enabled with --experimental.

Flags are temporary, so each one should have a bug tracking its removal.

Defined at line 16 of file ../../tools/fidl/fidlc/src/experimental_flags.h

enum class Nullability : uint8_t
Name Value
kNullable 0
kNonnullable 1

Defined at line 19 of file ../../tools/fidl/fidlc/src/properties.h

enum class Strictness : uint8_t
Name Value
kFlexible 0
kStrict 1

Defined at line 24 of file ../../tools/fidl/fidlc/src/properties.h

enum class ConstraintKind : uint8_t
Name Value
kHandleSubtype 0
kHandleRights 1
kSize 2
kNullability 3
kProtocol 4
kUtf8 5

Kinds of constraints that can be applied to types

Defined at line 25 of file ../../tools/fidl/fidlc/src/constraints.h

enum class Resourceness : uint8_t
Name Value
kValue 0
kResource 1

Defined at line 29 of file ../../tools/fidl/fidlc/src/properties.h

enum class Openness : uint8_t
Name Value
kClosed 0
kAjar 1
kOpen 2

Defined at line 34 of file ../../tools/fidl/fidlc/src/properties.h

enum class AbiKind : uint8_t
Name Value Comments
kValue 0

Bits/enum members

kOffset 1

Struct members

kOrdinal 2

Table/union/overlay members

kSelector 3

Protocol methods

Kinds of values that can determine an element's identity for ABI purposes.

Defined at line 45 of file ../../tools/fidl/fidlc/src/flat_ast.h

enum class HandleSubtype : uint32_t
Name Value Comments
kHandle 0

special case to indicate subtype is not specified.

kBti 24

special case to indicate subtype is not specified.

kChannel 4

special case to indicate subtype is not specified.

kClock 30

special case to indicate subtype is not specified.

kCounter 34

special case to indicate subtype is not specified.

kDebugLog 12

special case to indicate subtype is not specified.

kEvent 5

special case to indicate subtype is not specified.

kEventpair 16

special case to indicate subtype is not specified.

kException 29

special case to indicate subtype is not specified.

kFifo 19

special case to indicate subtype is not specified.

kGuest 20

special case to indicate subtype is not specified.

kInterrupt 9

special case to indicate subtype is not specified.

kIommu 23

special case to indicate subtype is not specified.

kIob 33

special case to indicate subtype is not specified.

kJob 17

special case to indicate subtype is not specified.

kMsi 32

special case to indicate subtype is not specified.

kPager 28

special case to indicate subtype is not specified.

kPciDevice 11

special case to indicate subtype is not specified.

kPmt 26

special case to indicate subtype is not specified.

kPort 6

special case to indicate subtype is not specified.

kProcess 1

special case to indicate subtype is not specified.

kProfile 25

special case to indicate subtype is not specified.

kResource 15

special case to indicate subtype is not specified.

kSocket 14

special case to indicate subtype is not specified.

kStream 31

special case to indicate subtype is not specified.

kSuspendToken 27

special case to indicate subtype is not specified.

kThread 2

special case to indicate subtype is not specified.

kTimer 22

special case to indicate subtype is not specified.

kVcpu 21

special case to indicate subtype is not specified.

kVmar 18

special case to indicate subtype is not specified.

kVmo 3

special case to indicate subtype is not specified.

TODO(https://fxbug.dev/42128146): zircon/types.h's zx_obj_type_t and related values must be

kept in sync with this. Eventually, they will be generated from

fidl declarations. This is currently tested by fidl-compiler's

TypesTests's handle_subtype test.

TODO(https://fxbug.dev/42143256): Remove this enumeration once handle generalization is

fully implemented. The enum `obj_type` defined in the FIDL library zx will

become the only source of truth.

NOLINTNEXTLINE(performance-enum-size): The size matches zx_obj_type_t.

Defined at line 50 of file ../../tools/fidl/fidlc/src/properties.h

enum class PrimitiveSubtype : uint8_t
Name Value
kBool 0
kInt8 1
kInt16 2
kInt32 3
kInt64 4
kUint8 5
kZxUchar 6
kUint16 7
kUint32 8
kUint64 9
kZxUsize64 10
kZxUintptr64 11
kFloat32 12
kFloat64 13

Defined at line 86 of file ../../tools/fidl/fidlc/src/properties.h

enum class InternalSubtype : uint8_t
Name Value
kFrameworkErr 0

Defined at line 103 of file ../../tools/fidl/fidlc/src/properties.h

enum class MessageKind : uint8_t
Name Value
kRequest 0
kResponse 1
kEvent 2

Defined at line 107 of file ../../tools/fidl/fidlc/src/properties.h

enum class DiagnosticKind : uint8_t
Name Value
kError 0
kWarning 1
kRetired 2

A tag that indicates whether a diagnostic definition is an error or warning.

In the future this could be extended to include hints, suggestions, etc.

Defined at line 109 of file ../../tools/fidl/fidlc/src/diagnostic_types.h

enum class ParseNumericResult : uint8_t
Name Value
kSuccess 0
kOutOfBounds 1
kMalformed 2

Defined at line 115 of file ../../tools/fidl/fidlc/src/utils.h

enum class TransportSide : uint8_t
Name Value
kClient 0
kServer 1

Defined at line 234 of file ../../tools/fidl/fidlc/src/types.h

Records

Functions

  • uint64_t Sha256MethodHasher (std::string_view selector)
  • template <class... Ts>
    overloaded<Ts...> <deduction guide for overloaded> (Ts... )
  • std::string_view FirstComponent (std::string_view name)

    Returns the first component of a name with 0 or more dots, e.g. "foo.bar" -> "foo".

    Defined at line 83 of file ../../tools/fidl/fidlc/src/utils.h

  • bool IsValidLibraryComponent (std::string_view component)

    Validators for parts of the FIDL grammar.

    See https://fuchsia.dev/fuchsia-src/reference/fidl/language/language#identifiers

  • bool IsValidIdentifierComponent (std::string_view component)
  • bool IsValidFullyQualifiedMethodIdentifier (std::string_view fq_identifier)
  • bool IsValidDiscoverableName (std::string_view discoverable_name)

    Validates a

    name. This is like a fully qualified identifier,

    but uses a dot instead of a slash so it can be used in a filesystem path.

  • std::string StripStringLiteralQuotes (std::string_view str)

    Removes the double quotes from the start and end of a string literal.

  • std::string StripDocCommentSlashes (std::string_view str)

    Removes the indentation and "///" from each line of a doc comment.

  • bool IsLowerSnakeCase (std::string_view str)
  • bool IsUpperSnakeCase (std::string_view str)
  • bool IsLowerCamelCase (std::string_view str)
  • bool IsUpperCamelCase (std::string_view str)
  • template <typename T>
    std::vector<std::unique_ptr<T>> MapClone (const std::vector<std::unique_ptr<T>> & original)

    Clones a vector of unique_ptr by calling Clone() on each element.

    Defined at line 33 of file ../../tools/fidl/fidlc/src/utils.h

  • std::string RemoveWhitespace (std::string str)

    Removes all whitespace characters from a string.

    Defined at line 102 of file ../../tools/fidl/fidlc/src/utils.h

  • template <typename NumericType>
    ParseNumericResult ParseNumeric (std::string_view input, NumericType * out_value, int base)

    Defined at line 122 of file ../../tools/fidl/fidlc/src/utils.h

  • template <ConstraintKind K>
    bool MergeConstraint (Reporter * reporter, const Name & layout_name, const Constraint<K> & base, const Constraint<K> & resolved, Constraint<K> * out_merged)

    Merge two |Constraint| objects of the same |ConstraintKind|.

    It's an error for them to both be set.

    Defined at line 201 of file ../../tools/fidl/fidlc/src/constraints.h

  • std::string ToLowerSnakeCase (std::string_view str)
  • std::string ToUpperSnakeCase (std::string_view str)
  • std::string ToLowerCamelCase (std::string_view str)
  • std::string ToUpperCamelCase (std::string_view str)
  • std::vector<std::string> SplitIdentifierWords (std::string_view str)

    Splits an identifier into lowercase words. Works for any naming style.

  • std::string Canonicalize (std::string_view identifier)

    Returns the canonical form of an identifier, used to detect name collisions

    in FIDL libraries. For example, the identifiers "FooBar" and "FOO_BAR"

    collide because both canonicalize to "foo_bar".

  • uint32_t DecodeUnicodeHex (std::string_view str)

    Decodes 1 to 6 hex digits like "a" or "123" or "FFFFFF".

  • uint32_t StringLiteralLength (std::string_view str)

    Given the source code of a string literal (including the double quotes),

    returns the length of the UTF-8 string it represents in bytes.

  • bool IsValidImplementationLocation (std::string_view location)

    IsValidImplementationLocation validates the name of a place that could

    implement a protocol endpoint, encode a type or decode a type. It must be

    one of "platform" or "external".

  • bool IsValidImplementationLocations (std::string_view locations)

    IsValidImplementationLocations validates a comma separated list of

    location names, as constrained by IsValidImplementationLocation.

    Items must be separated by commas but may have additional whitespace.

  • bool MergeConstraint (Reporter * reporter, const Name & layout_name, const Constraint<K> & base, const Constraint<K> & resolved, Constraint<K> * out_merged)
  • std::optional<std::vector<std::string_view>> ParseImplementationLocations (std::string_view locations)

    ParseImplementationLocations parses a string containing a comma separated

    list of implementation locations, or std::nullopt if the list is malformed.

  • void PrintFinding (std::ostream & os, const Finding & finding)

    Used by fidl-lint FormatFindings, and for testing, this generates the linter

    error message string in the format required for the Reporter.

  • std::vector<std::string> FormatFindings (const Findings & findings, bool enable_color)

    Used by fidl-lint main() and for testing, this generates the linter error

    messages for a list of findings.

Variables

const std::map<std::string_view, ExperimentalFlag> kAllExperimentalFlags