示例#1
0
        internal static DebugType GetLLVMDebugType(LLVMDIBuilderRef pBuilder, LLVMMetadataRef pScope, LLVMMetadataRef pFile, SmallType pType)
        {
            DebugType t = default;

            if (!_debugMappings.ContainsKey(pType))
            {
                if (pType.IsArray)
                {
                    var elementType = GetLLVMDebugType(pBuilder, pScope, pFile, pType.GetElementType());
                    var value       = LLVM.DIBuilderCreateArrayType(pBuilder, elementType.Size, 0, elementType.Value, default);

                    t = new DebugType(elementType.Size + _pointerSize, value);
                }
                else if (pType.IsTuple || pType.IsStruct || pType.IsTrait)
                {
                    ulong           size   = 0;
                    ulong           offset = 0;
                    LLVMMetadataRef type   = default;
                    foreach (var f in pType.GetFields())
                    {
                        var memberType = GetLLVMDebugType(pBuilder, pScope, pFile, f.Type);
                        type    = LLVM.DIBuilderCreateMemberType(pBuilder, pScope, f.Name, pFile, 0, memberType.Size, 0, offset, 0, memberType.Value);
                        offset += memberType.Size;
                    }
                    var value = LLVM.DIBuilderCreateStructType(pBuilder, pScope, pType.Name, pFile, 0, 0, 0, 0, default, type);
示例#2
0
 //Array constructor
 internal SmallType(string pName, SmallType pElementType)
 {
     Name         = pName;
     _elementType = pElementType;
 }