//===-- CodeViewTypes.def - All CodeView leaf types -------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// See LEAF_ENUM_e in cvinfo.h. This should match the constants there.
//
//===----------------------------------------------------------------------===//

// If the type is known, then we have a record describing it in TypeRecord.h.

#ifndef CV_TYPE
#define CV_TYPE(lf_ename, value)
#endif

// If the type is known, then we have a record describing it in TypeRecord.h.
#ifndef TYPE_RECORD
#define TYPE_RECORD(lf_ename, value, name) CV_TYPE(lf_ename, value)
#endif

#ifndef TYPE_RECORD_ALIAS
#define TYPE_RECORD_ALIAS(lf_ename, value, name, alias_name)                   \
  TYPE_RECORD(lf_ename, value, name)
#endif

#ifndef MEMBER_RECORD
#define MEMBER_RECORD(lf_ename, value, name) TYPE_RECORD(lf_ename, value, name)
#endif

#ifndef MEMBER_RECORD_ALIAS
#define MEMBER_RECORD_ALIAS(lf_ename, value, name, alias_name)                 \
  MEMBER_RECORD(lf_ename, value, name)
#endif

TYPE_RECORD(LF_POINTER, 0x1002, Pointer)
TYPE_RECORD(LF_MODIFIER, 0x1001, Modifier)
TYPE_RECORD(LF_PROCEDURE, 0x1008, Procedure)
TYPE_RECORD(LF_MFUNCTION, 0x1009, MemberFunction)
TYPE_RECORD(LF_LABEL, 0x000e, Label)
TYPE_RECORD(LF_ARGLIST, 0x1201, ArgList)

TYPE_RECORD(LF_FIELDLIST, 0x1203, FieldList)

TYPE_RECORD(LF_ARRAY, 0x1503, Array)
TYPE_RECORD(LF_CLASS, 0x1504, Class)
TYPE_RECORD_ALIAS(LF_STRUCTURE, 0x1505, Struct, Class)
TYPE_RECORD_ALIAS(LF_INTERFACE, 0x1519, Interface, Class)
TYPE_RECORD(LF_UNION, 0x1506, Union)
TYPE_RECORD(LF_ENUM, 0x1507, Enum)
TYPE_RECORD(LF_TYPESERVER2, 0x1515, TypeServer2)
TYPE_RECORD(LF_VFTABLE, 0x151d, VFTable)
TYPE_RECORD(LF_VTSHAPE, 0x000a, VFTableShape)

TYPE_RECORD(LF_BITFIELD, 0x1205, BitField)

// Member type records. These are generally not length prefixed, and appear
// inside of a field list record.
MEMBER_RECORD(LF_BCLASS, 0x1400, BaseClass)
MEMBER_RECORD_ALIAS(LF_BINTERFACE, 0x151a, BaseInterface, BaseClass)

MEMBER_RECORD(LF_VBCLASS, 0x1401, VirtualBaseClass)
MEMBER_RECORD_ALIAS(LF_IVBCLASS, 0x1402, IndirectVirtualBaseClass,
                    VirtualBaseClass)

MEMBER_RECORD(LF_VFUNCTAB, 0x1409, VFPtr)
MEMBER_RECORD(LF_STMEMBER, 0x150e, StaticDataMember)
MEMBER_RECORD(LF_METHOD, 0x150f, OverloadedMethod)
MEMBER_RECORD(LF_MEMBER, 0x150d, DataMember)
MEMBER_RECORD(LF_NESTTYPE, 0x1510, NestedType)
MEMBER_RECORD(LF_ONEMETHOD, 0x1511, OneMethod)
MEMBER_RECORD(LF_ENUMERATE, 0x1502, Enumerator)
MEMBER_RECORD(LF_INDEX, 0x1404, ListContinuation)

// ID leaf records. Subsequent leaf types may be referenced from .debug$S.
TYPE_RECORD(LF_FUNC_ID, 0x1601, FuncId)
TYPE_RECORD(LF_MFUNC_ID, 0x1602, MemberFuncId)
TYPE_RECORD(LF_BUILDINFO, 0x1603, BuildInfo)
TYPE_RECORD(LF_SUBSTR_LIST, 0x1604, StringList)
TYPE_RECORD(LF_STRING_ID, 0x1605, StringId)
TYPE_RECORD(LF_UDT_SRC_LINE, 0x1606, UdtSourceLine)
TYPE_RECORD(LF_UDT_MOD_SRC_LINE, 0x1607, UdtModSourceLine)


TYPE_RECORD(LF_METHODLIST, 0x1206, MethodOverloadList)

TYPE_RECORD(LF_PRECOMP, 0x1509, Precomp)
TYPE_RECORD(LF_ENDPRECOMP, 0x0014, EndPrecomp)

// 16 bit type records.
CV_TYPE(LF_MODIFIER_16t, 0x0001)
CV_TYPE(LF_POINTER_16t, 0x0002)
CV_TYPE(LF_ARRAY_16t, 0x0003)
CV_TYPE(LF_CLASS_16t, 0x0004)
CV_TYPE(LF_STRUCTURE_16t, 0x0005)
CV_TYPE(LF_UNION_16t, 0x0006)
CV_TYPE(LF_ENUM_16t, 0x0007)
CV_TYPE(LF_PROCEDURE_16t, 0x0008)
CV_TYPE(LF_MFUNCTION_16t, 0x0009)
CV_TYPE(LF_COBOL0_16t, 0x000b)
CV_TYPE(LF_COBOL1, 0x000c)
CV_TYPE(LF_BARRAY_16t, 0x000d)
CV_TYPE(LF_NULLLEAF, 0x000f) // LF_NULL
CV_TYPE(LF_NOTTRAN, 0x0010)
CV_TYPE(LF_DIMARRAY_16t, 0x0011)
CV_TYPE(LF_VFTPATH_16t, 0x0012)
CV_TYPE(LF_PRECOMP_16t, 0x0013)
CV_TYPE(LF_OEM_16t, 0x0015)
CV_TYPE(LF_TYPESERVER_ST, 0x0016)

CV_TYPE(LF_SKIP_16t, 0x0200)
CV_TYPE(LF_ARGLIST_16t, 0x0201)
CV_TYPE(LF_DEFARG_16t, 0x0202)
CV_TYPE(LF_LIST, 0x0203)
CV_TYPE(LF_FIELDLIST_16t, 0x0204)
CV_TYPE(LF_DERIVED_16t, 0x0205)
CV_TYPE(LF_BITFIELD_16t, 0x0206)
CV_TYPE(LF_METHODLIST_16t, 0x0207)
CV_TYPE(LF_DIMCONU_16t, 0x0208)
CV_TYPE(LF_DIMCONLU_16t, 0x0209)
CV_TYPE(LF_DIMVARU_16t, 0x020a)
CV_TYPE(LF_DIMVARLU_16t, 0x020b)
CV_TYPE(LF_REFSYM, 0x020c)

// 16 bit member types. Generally not length prefixed.
CV_TYPE(LF_BCLASS_16t, 0x0400)
CV_TYPE(LF_VBCLASS_16t, 0x0401)
CV_TYPE(LF_IVBCLASS_16t, 0x0402)
CV_TYPE(LF_ENUMERATE_ST, 0x0403)
CV_TYPE(LF_FRIENDFCN_16t, 0x0404)
CV_TYPE(LF_INDEX_16t, 0x0405)
CV_TYPE(LF_MEMBER_16t, 0x0406)
CV_TYPE(LF_STMEMBER_16t, 0x0407)
CV_TYPE(LF_METHOD_16t, 0x0408)
CV_TYPE(LF_NESTTYPE_16t, 0x0409)
CV_TYPE(LF_VFUNCTAB_16t, 0x040a)
CV_TYPE(LF_FRIENDCLS_16t, 0x040b)
CV_TYPE(LF_ONEMETHOD_16t, 0x040c)
CV_TYPE(LF_VFUNCOFF_16t, 0x040d)

CV_TYPE(LF_TI16_MAX, 0x1000)

CV_TYPE(LF_ARRAY_ST, 0x1003)
CV_TYPE(LF_CLASS_ST, 0x1004)
CV_TYPE(LF_STRUCTURE_ST, 0x1005)
CV_TYPE(LF_UNION_ST, 0x1006)
CV_TYPE(LF_ENUM_ST, 0x1007)
CV_TYPE(LF_COBOL0, 0x100a)
CV_TYPE(LF_BARRAY, 0x100b)
CV_TYPE(LF_DIMARRAY_ST, 0x100c)
CV_TYPE(LF_VFTPATH, 0x100d)
CV_TYPE(LF_PRECOMP_ST, 0x100e)
CV_TYPE(LF_OEM, 0x100f)
CV_TYPE(LF_ALIAS_ST, 0x1010)
CV_TYPE(LF_OEM2, 0x1011)

CV_TYPE(LF_SKIP, 0x1200)
CV_TYPE(LF_DEFARG_ST, 0x1202)
CV_TYPE(LF_DERIVED, 0x1204)
CV_TYPE(LF_DIMCONU, 0x1207)
CV_TYPE(LF_DIMCONLU, 0x1208)
CV_TYPE(LF_DIMVARU, 0x1209)
CV_TYPE(LF_DIMVARLU, 0x120a)

// Member type records. These are generally not length prefixed, and appear
// inside of a field list record.
CV_TYPE(LF_FRIENDFCN_ST, 0x1403)
CV_TYPE(LF_MEMBER_ST, 0x1405)
CV_TYPE(LF_STMEMBER_ST, 0x1406)
CV_TYPE(LF_METHOD_ST, 0x1407)
CV_TYPE(LF_NESTTYPE_ST, 0x1408)
CV_TYPE(LF_FRIENDCLS, 0x140a)
CV_TYPE(LF_ONEMETHOD_ST, 0x140b)
CV_TYPE(LF_VFUNCOFF, 0x140c)
CV_TYPE(LF_NESTTYPEEX_ST, 0x140d)
CV_TYPE(LF_MEMBERMODIFY_ST, 0x140e)
CV_TYPE(LF_MANAGED_ST, 0x140f)

CV_TYPE(LF_ST_MAX, 0x1500)
CV_TYPE(LF_TYPESERVER, 0x1501)
CV_TYPE(LF_DIMARRAY, 0x1508)
CV_TYPE(LF_ALIAS, 0x150a)
CV_TYPE(LF_DEFARG, 0x150b)
CV_TYPE(LF_FRIENDFCN, 0x150c)
CV_TYPE(LF_NESTTYPEEX, 0x1512)
CV_TYPE(LF_MEMBERMODIFY, 0x1513)
CV_TYPE(LF_MANAGED, 0x1514)
CV_TYPE(LF_STRIDED_ARRAY, 0x1516)
CV_TYPE(LF_HLSL, 0x1517)
CV_TYPE(LF_MODIFIER_EX, 0x1518)
CV_TYPE(LF_VECTOR, 0x151b)
CV_TYPE(LF_MATRIX, 0x151c)

// ID leaf records. Subsequent leaf types may be referenced from .debug$S.

// Numeric leaf types. These are generally contained in other records, and not
// encountered in the main type stream.

CV_TYPE(LF_NUMERIC, 0x8000)
CV_TYPE(LF_CHAR, 0x8000)
CV_TYPE(LF_SHORT, 0x8001)
CV_TYPE(LF_USHORT, 0x8002)
CV_TYPE(LF_LONG, 0x8003)
CV_TYPE(LF_ULONG, 0x8004)
CV_TYPE(LF_REAL32, 0x8005)
CV_TYPE(LF_REAL64, 0x8006)
CV_TYPE(LF_REAL80, 0x8007)
CV_TYPE(LF_REAL128, 0x8008)
CV_TYPE(LF_QUADWORD, 0x8009)
CV_TYPE(LF_UQUADWORD, 0x800a)
CV_TYPE(LF_REAL48, 0x800b)
CV_TYPE(LF_COMPLEX32, 0x800c)
CV_TYPE(LF_COMPLEX64, 0x800d)
CV_TYPE(LF_COMPLEX80, 0x800e)
CV_TYPE(LF_COMPLEX128, 0x800f)
CV_TYPE(LF_VARSTRING, 0x8010)
CV_TYPE(LF_OCTWORD, 0x8017)
CV_TYPE(LF_UOCTWORD, 0x8018)
CV_TYPE(LF_DECIMAL, 0x8019)
CV_TYPE(LF_DATE, 0x801a)
CV_TYPE(LF_UTF8STRING, 0x801b)
CV_TYPE(LF_REAL16, 0x801c)

// Padding bytes. These are emitted into alignment bytes in the type stream.

CV_TYPE(LF_PAD0, 0xf0)
CV_TYPE(LF_PAD1, 0xf1)
CV_TYPE(LF_PAD2, 0xf2)
CV_TYPE(LF_PAD3, 0xf3)
CV_TYPE(LF_PAD4, 0xf4)
CV_TYPE(LF_PAD5, 0xf5)
CV_TYPE(LF_PAD6, 0xf6)
CV_TYPE(LF_PAD7, 0xf7)
CV_TYPE(LF_PAD8, 0xf8)
CV_TYPE(LF_PAD9, 0xf9)
CV_TYPE(LF_PAD10, 0xfa)
CV_TYPE(LF_PAD11, 0xfb)
CV_TYPE(LF_PAD12, 0xfc)
CV_TYPE(LF_PAD13, 0xfd)
CV_TYPE(LF_PAD14, 0xfe)
CV_TYPE(LF_PAD15, 0xff)

#undef CV_TYPE
#undef TYPE_RECORD
#undef TYPE_RECORD_ALIAS
#undef MEMBER_RECORD
#undef MEMBER_RECORD_ALIAS
