================================================================================
Typedef: types
================================================================================

typedef void *SDWebImageContextOption;
typedef id<NSCoding> SDStateImageURLDictionary;
typedef NSMutableDictionary<NSString *, id> SDCallbacksDictionary;
typedef NSMutableDictionary<NSString *, NSURL *> SDStateImageURLDictionary;
typedef id _Nonnull nonnull_id;
typedef SEL _Nonnull nonnull_SEL;

--------------------------------------------------------------------------------

(translation_unit
  (type_definition
    type: (primitive_type)
    declarator: (pointer_declarator
      declarator: (type_identifier)))
  (type_definition
    type: (generic_type_specifier
      class_name: (id)
      type_reference: (protocol_qualifiers
        (protocol_identifier)))
    attributes: (identifier))
  (type_definition
    type: (generic_type_specifier
      class_name: (type_identifier)
      type_reference: (generic_type_references
        (type_descriptor
          type: (type_identifier)
          declarator: (abstract_pointer_declarator))
        (type_descriptor
          type: (id))))
    attributes: (identifier))
  (type_definition
    type: (generic_type_specifier
      class_name: (type_identifier)
      type_reference: (generic_type_references
        (type_descriptor
          type: (type_identifier)
          declarator: (abstract_pointer_declarator))
        (type_descriptor
          type: (type_identifier)
          declarator: (abstract_pointer_declarator))))
    attributes: (identifier))
  (type_definition
    type: (id)
    (type_qualifier)
    attributes: (identifier))
  (type_definition
    type: (SEL)
    (type_qualifier)
    attributes: (identifier)))

================================================================================
Typedef: attributes
================================================================================

typedef NSString * SDImageCoderOption NS_STRING_ENUM;
typedef NSString * SDWebImageContextOption NS_EXTENSIBLE_STRING_ENUM;
typedef NSString * SDImageFormat NS_TYPED_ENUM;
typedef NSInteger SDImageFormat NS_TYPED_EXTENSIBLE_ENUM;

--------------------------------------------------------------------------------

(translation_unit
  (type_definition
    type: (type_identifier)
    declarator: (pointer_declarator
      declarator: (type_identifier))
    attributes: (identifier))
  (type_definition
    type: (type_identifier)
    declarator: (pointer_declarator
      declarator: (type_identifier))
    attributes: (identifier))
  (type_definition
    type: (type_identifier)
    declarator: (pointer_declarator
      declarator: (type_identifier))
    attributes: (identifier))
  (type_definition
    type: (type_identifier)
    declarator: (type_identifier)
    attributes: (identifier)))

================================================================================
Typedef: llvm attributes
================================================================================

__attribute__((deprecated("Use DDContextAllowlistFilterLogFormatter instead")))
typedef DDContextAllowlistFilterLogFormatter DDContextWhitelistFilterLogFormatter;

typedef __attribute__((__ext_vector_type__(2))) float vector_float2;

--------------------------------------------------------------------------------

(translation_unit
  (type_definition
    (attribute_specifier
      (argument_list
        (call_expression
          function: (identifier)
          arguments: (argument_list
            (string_literal)))))
    type: (type_identifier)
    attributes: (identifier))
  (type_definition
    (attribute_specifier
      (argument_list
        (call_expression
          function: (identifier)
          arguments: (argument_list
            (number_literal)))))
    type: (primitive_type)
    attributes: (identifier)))

================================================================================
Typedef: struct
================================================================================

typedef struct __attribute__((objc_boxable)) _NSRange {
    NSUInteger location;
    NSUInteger length;
} NSRange;

--------------------------------------------------------------------------------

(translation_unit
  (type_definition
    type: (struct_specifier
      (attribute_specifier
        (argument_list
          (identifier)))
      name: (type_identifier)
      body: (field_declaration_list
        (field_declaration
          type: (type_identifier)
          declarator: (field_identifier))
        (field_declaration
          type: (type_identifier)
          declarator: (field_identifier))))
    attributes: (identifier)))

================================================================================
Typedef: struct
================================================================================

typedef struct _AspectBlock {
  __unused Class isa;
  void (*invoke)(struct _AspectBlock *block, ...);
} *AspectBlockRef;

--------------------------------------------------------------------------------

(translation_unit
  (type_definition
    type: (struct_specifier
      name: (type_identifier)
      body: (field_declaration_list
        (field_declaration
          (type_qualifier)
          type: (Class)
          declarator: (field_identifier))
        (field_declaration
          type: (primitive_type)
          declarator: (function_declarator
            declarator: (parenthesized_declarator
              (pointer_declarator
                declarator: (field_identifier)))
            parameters: (parameter_list
              (parameter_declaration
                type: (struct_specifier
                  name: (type_identifier))
                declarator: (pointer_declarator
                  declarator: (identifier))))))))
    declarator: (pointer_declarator
      declarator: (type_identifier))))

================================================================================
Typedef: typedef in implementation
================================================================================

@implementation ClassName
typedef struct {
    u_int64_t appMemory;
    u_int64_t usedMemory;
    u_int64_t totalMemory;
    u_int64_t availableMemory;
} Memory;
@end

--------------------------------------------------------------------------------

(translation_unit
  (class_implementation
    name: (identifier)
    (type_definition
      type: (struct_specifier
        body: (field_declaration_list
          (field_declaration
            type: (type_identifier)
            declarator: (field_identifier))
          (field_declaration
            type: (type_identifier)
            declarator: (field_identifier))
          (field_declaration
            type: (type_identifier)
            declarator: (field_identifier))
          (field_declaration
            type: (type_identifier)
            declarator: (field_identifier))))
      attributes: (identifier))))

================================================================================
Typedef: block
================================================================================

typedef void(^blockName)(void);

typedef void (^AFURLSessionTaskDidFinishCollectingMetricsBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLSessionTaskMetrics * metrics) API_AVAILABLE(ios(10), macosx(10.12), watchos(3), tvos(10));

typedef void (^JSONObjectBlock)(id json, JSONModelError *err) DEPRECATED_ATTRIBUTE;

--------------------------------------------------------------------------------

(translation_unit
  (type_definition
    type: (primitive_type)
    declarator: (block_declarator
      declarator: (identifier)
      parameters: (parameter_list
        (parameter_declaration
          type: (primitive_type)))))
  (type_definition
    type: (primitive_type)
    declarator: (block_declarator
      declarator: (identifier)
      parameters: (parameter_list
        (parameter_declaration
          type: (type_identifier)
          declarator: (pointer_declarator
            declarator: (identifier)))
        (parameter_declaration
          type: (type_identifier)
          declarator: (pointer_declarator
            declarator: (identifier)))
        (parameter_declaration
          type: (type_identifier)
          declarator: (pointer_declarator
            declarator: (identifier)))))
    (attribute_specifier
      (availability_attribute_specifier
        (platform_version
          platform: (platform)
          version: (number_literal))
        (platform_version
          platform: (platform)
          version: (number_literal))
        (platform_version
          platform: (platform)
          version: (number_literal))
        (platform_version
          platform: (platform)
          version: (number_literal)))))
  (type_definition
    type: (primitive_type)
    declarator: (block_declarator
      declarator: (identifier)
      parameters: (parameter_list
        (parameter_declaration
          type: (id)
          declarator: (identifier))
        (parameter_declaration
          type: (type_identifier)
          declarator: (pointer_declarator
            declarator: (identifier)))))
    (attribute_specifier
      (availability_attribute_specifier))))

================================================================================
Typedef: IMP
================================================================================

typedef id (*NSNumberAllocImp)(id receiver, SEL selector);
typedef void (*mtl_failedMethodCallback)(Class, Method);

--------------------------------------------------------------------------------

(translation_unit
  (type_definition
    type: (id)
    declarator: (function_declarator
      declarator: (parenthesized_declarator
        (pointer_declarator
          declarator: (type_identifier)))
      parameters: (parameter_list
        (parameter_declaration
          type: (id)
          declarator: (identifier))
        (parameter_declaration
          type: (SEL)
          declarator: (identifier)))))
  (type_definition
    type: (primitive_type)
    declarator: (function_declarator
      declarator: (parenthesized_declarator
        (pointer_declarator
          declarator: (type_identifier)))
      parameters: (parameter_list
        (parameter_declaration
          type: (Class))
        (parameter_declaration
          type: (type_identifier))))))

================================================================================
Typedef: NS_ENUM
================================================================================

typedef NS_ENUM(NSUInteger, RLMSyncStopPolicy);

typedef NS_ENUM(NSUInteger, SDAnimatedImagePlaybackMode) {
    /**
     * From first to last frame and stop or next loop.
     */
    SDAnimatedImagePlaybackModeNormal = 0,
    /**
     * From last frame to first frame and stop or next loop.
     */
    SDAnimatedImagePlaybackModeReverse,
    /**
     * From first frame to last frame and reverse again, like reciprocating.
     */
    SDAnimatedImagePlaybackModeBounce,
    /**
     * From last frame to first frame and reverse again, like reversed reciprocating.
     */
    SDAnimatedImagePlaybackModeReversedBounce,
};

typedef NS_ERROR_ENUM(SDWebImageErrorDomain, SDWebImageError) {
    SDWebImageErrorInvalidURL = 1000, // The URL is invalid, such as nil URL or corrupted URL
};

typedef enum {
    AvatarStyleRound = 0,
    AvatarStyleRectangle,
} AvatarStyle;

typedef enum AvatarStyle : NSUInteger {
    AvatarStyleRound = 0,
    AvatarStyleRectangle,
} AvatarStyle;

--------------------------------------------------------------------------------

(translation_unit
  (type_definition
    type: (enum_specifier
      type: (type_identifier)
      name: (type_identifier)))
  (type_definition
    type: (enum_specifier
      type: (type_identifier)
      name: (type_identifier)
      body: (enumerator_list
        (comment)
        (enumerator
          name: (identifier)
          value: (number_literal))
        (comment)
        (enumerator
          name: (identifier))
        (comment)
        (enumerator
          name: (identifier))
        (comment)
        (enumerator
          name: (identifier)))))
  (type_definition
    type: (enum_specifier
      type: (type_identifier)
      name: (type_identifier)
      body: (enumerator_list
        (enumerator
          name: (identifier)
          value: (number_literal))
        (comment))))
  (type_definition
    type: (enum_specifier
      body: (enumerator_list
        (enumerator
          name: (identifier)
          value: (number_literal))
        (enumerator
          name: (identifier))))
    attributes: (identifier))
  (type_definition
    type: (enum_specifier
      name: (type_identifier)
      superclass: (type_identifier)
      body: (enumerator_list
        (enumerator
          name: (identifier)
          value: (number_literal))
        (enumerator
          name: (identifier))))
    attributes: (identifier)))

================================================================================
Typedef: NS_ENUM without typedef
================================================================================

NS_ENUM(NSInteger)
{
    ATZShellTerminationStatusError = 666,
    ATZShellLaunchError = 667
};

--------------------------------------------------------------------------------

(translation_unit
  (enum_specifier
    type: (type_identifier)
    body: (enumerator_list
      (enumerator
        name: (identifier)
        value: (number_literal))
      (enumerator
        name: (identifier)
        value: (number_literal)))))

================================================================================
Typedef: NS_ENUM availability
================================================================================

typedef NS_ENUM(NSInteger, TTCameraDetectionType) {
    TTCameraDetectionTypeNone,
    TTCameraDetectionTypeFace1 NS_AVAILABLE(10_7, 5_0),
    TTCameraDetectionTypeFace2 NS_ENUM_DEPRECATED_IOS(2_0, 9_0, "unavailable"),
    TTCameraDetectionTypeFace3 __deprecated_enum_msg("unavailable"),
    TTCameraDetectionTypeFace4 __attribute__((deprecated)) __deprecated_enum_msg("unavailable"),
} NS_ENUM_DEPRECATED_IOS(3_0, 7_0, "");

--------------------------------------------------------------------------------

(translation_unit
  (type_definition
    type: (enum_specifier
      type: (type_identifier)
      name: (type_identifier)
      body: (enumerator_list
        (enumerator
          name: (identifier))
        (enumerator
          name: (identifier)
          (attribute_specifier
            (availability_attribute_specifier
              (platform_version)
              (platform_version))))
        (enumerator
          name: (identifier)
          (attribute_specifier
            (availability_attribute_specifier
              (platform_version)
              (platform_version)
              message: (string_literal))))
        (enumerator
          name: (identifier)
          (attribute_specifier
            (availability_attribute_specifier
              message: (string_literal))))
        (enumerator
          name: (identifier)
          (attribute_specifier
            (argument_list
              (identifier)))
          (attribute_specifier
            (availability_attribute_specifier
              message: (string_literal))))))
    (attribute_specifier
      (availability_attribute_specifier
        (platform_version)
        (platform_version)
        message: (string_literal)))))

================================================================================
Typedef: NS_ENUM NS_SWIFT_NAME
================================================================================

typedef NS_ENUM(NSInteger, SVProgressHUDStyle) {
    SVProgressHUDStyleLight NS_SWIFT_NAME(light),   // default style, white HUD with black text, HUD background will be blurred
    SVProgressHUDStyleDark NS_SWIFT_NAME(dark),     // black HUD and white text, HUD background will be blurred
    SVProgressHUDStyleCustom NS_SWIFT_NAME(custom)  // uses the fore- and background color properties
};

--------------------------------------------------------------------------------

(translation_unit
  (type_definition
    type: (enum_specifier
      type: (type_identifier)
      name: (type_identifier)
      body: (enumerator_list
        (enumerator
          name: (identifier)
          (swift_name_attribute_sepcifier
            method: (identifier)))
        (comment)
        (enumerator
          name: (identifier)
          (swift_name_attribute_sepcifier
            method: (identifier)))
        (comment)
        (enumerator
          name: (identifier)
          (swift_name_attribute_sepcifier
            method: (identifier)))
        (comment)))))

================================================================================
Typedef: NS_OPTIONS
================================================================================

typedef NS_OPTIONS(NSUInteger, ActionType) {
    ActionTypeUp    = 1 << 0, // 1
    ActionTypeDown  = 1 << 1, // 2
    ActionTypeRight = 1 << 2, // 4
    ActionTypeLeft  = 1 << 3, // 8
};


--------------------------------------------------------------------------------

(translation_unit
  (type_definition
    type: (enum_specifier
      type: (type_identifier)
      name: (type_identifier)
      body: (enumerator_list
        (enumerator
          name: (identifier)
          value: (binary_expression
            left: (number_literal)
            right: (number_literal)))
        (comment)
        (enumerator
          name: (identifier)
          value: (binary_expression
            left: (number_literal)
            right: (number_literal)))
        (comment)
        (enumerator
          name: (identifier)
          value: (binary_expression
            left: (number_literal)
            right: (number_literal)))
        (comment)
        (enumerator
          name: (identifier)
          value: (binary_expression
            left: (number_literal)
            right: (number_literal)))
        (comment)))))
