chromium/components/zucchini/type_dex.h

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_ZUCCHINI_TYPE_DEX_H_
#define COMPONENTS_ZUCCHINI_TYPE_DEX_H_

#include <stdint.h>

namespace zucchini {
namespace dex {
// Contains types that models DEX executable format data structures.
// See https://source.android.com/devices/tech/dalvik/dex-format

// The supported versions are 035, 037, 038, and 039.

enum class FormatId : uint8_t {};

struct Instruction {};

constexpr Instruction kByteCode[] =;

// Supported by MSVC, g++, and clang++. Ensures no gaps in packing.
#pragma pack(push, 1)

// header_item: Appears in the header section.
struct HeaderItem {};

// string_id_item: String identifiers list.
struct StringIdItem {};

// type_id_item: Type identifiers list.
struct TypeIdItem {};

// proto_id_item: Method prototype identifiers list.
struct ProtoIdItem {};

// field_id_item: Field identifiers list.
struct FieldIdItem {};

// method_id_item: Method identifiers list.
struct MethodIdItem {};

// class_def_item: Class definitions list.
struct ClassDefItem {};

// call_site_id_item: Call site identifiers list.
struct CallSiteIdItem {};

// method_handle_type: Determines the behavior of the MethodHandleItem.
enum class MethodHandleType : uint16_t {};

// method_handle_item: Method handles referred within the Dex file.
struct MethodHandleItem {};

// code_item: Header of a code item.
struct CodeItem {};

// Number of valid type codes for map_item elements in map_list.
// See: https://source.android.com/devices/tech/dalvik/dex-format#type-codes
constexpr uint32_t kMaxItemListSize =;

constexpr uint16_t kTypeHeaderItem =;
constexpr uint16_t kTypeStringIdItem =;
constexpr uint16_t kTypeTypeIdItem =;
constexpr uint16_t kTypeProtoIdItem =;
constexpr uint16_t kTypeFieldIdItem =;
constexpr uint16_t kTypeMethodIdItem =;
constexpr uint16_t kTypeClassDefItem =;
constexpr uint16_t kTypeCallSiteIdItem =;
constexpr uint16_t kTypeMethodHandleItem =;
constexpr uint16_t kTypeMapList =;
constexpr uint16_t kTypeTypeList =;
constexpr uint16_t kTypeAnnotationSetRefList =;
constexpr uint16_t kTypeAnnotationSetItem =;
constexpr uint16_t kTypeClassDataItem =;
constexpr uint16_t kTypeCodeItem =;
constexpr uint16_t kTypeStringDataItem =;
constexpr uint16_t kTypeDebugInfoItem =;
constexpr uint16_t kTypeAnnotationItem =;
constexpr uint16_t kTypeEncodedArrayItem =;
constexpr uint16_t kTypeAnnotationsDirectoryItem =;
constexpr uint16_t kTypeHiddenApiClassDataItem =;

// map_item
struct MapItem {};

// map_list
struct MapList {};

// type_item
struct TypeItem {};

// annotation_set_ref_item
struct AnnotationSetRefItem {};

// annotation_off_item
struct AnnotationOffItem {};

// field_annotation
struct FieldAnnotation {};

// method_annotation
struct MethodAnnotation {};

// parameter_annotation
struct ParameterAnnotation {};

// annotations_directory_item
struct AnnotationsDirectoryItem {};

// try_item
struct TryItem {};

#pragma pack(pop)

}  // namespace dex
}  // namespace zucchini

#endif  // COMPONENTS_ZUCCHINI_TYPE_DEX_H_