Namespaces

Enumerations

enum ExperimentalFlag
Name Value
kAllowNewTypes 1 << 0
kOutputIndexJson 1 << 1
kZxCTypes 1 << 2
kAllowArbitraryErrorTypes 1 << 3
kNoResourceAttribute 1 << 4

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 Nullability
Name Value
kNullable 0
kNonnullable 1

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

enum Strictness
Name Value
kFlexible 0
kStrict 1

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

enum ConstraintKind
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 Resourceness
Name Value
kValue 0
kResource 1

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

enum Openness
Name Value
kClosed 0
kAjar 1
kOpen 2

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

enum AbiKind
Name Value
kValue 0
kOffset 1
kOrdinal 2
kSelector 3

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 HandleSubtype
Name Value
kHandle 0
kBti 24
kChannel 4
kClock 30
kCounter 34
kDebugLog 12
kEvent 5
kEventpair 16
kException 29
kFifo 19
kGuest 20
kInterrupt 9
kIommu 23
kIob 33
kJob 17
kMsi 32
kPager 28
kPciDevice 11
kPmt 26
kPort 6
kProcess 1
kProfile 25
kResource 15
kSocket 14
kStream 31
kSuspendToken 27
kThread 2
kTimer 22
kVcpu 21
kVmar 18
kVmo 3

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 PrimitiveSubtype
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 InternalSubtype
Name Value
kFrameworkErr 0

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

enum MessageKind
Name Value
kRequest 0
kResponse 1
kEvent 2

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

enum DiagnosticKind
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 ParseNumericResult
Name Value
kSuccess 0
kOutOfBounds 1
kMalformed 2

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

enum TransportSide
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 & findingsbool 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