Пример #1
0
 public DebugStructType(IStructType llvmType
                        , NativeModule module
                        , DIScope scope
                        , string name
                        , DIFile file
                        , uint line
                        , DebugInfoFlags debugFlags
                        , DIType derivedFrom
                        , IEnumerable <DIType> elements
                        , uint alignment = 0
                        )
     : base(llvmType)
 {
     module.VerifyArgNotNull(nameof(module));
     DIType = module.DIBuilder
              .CreateStructType(scope
                                , name
                                , file
                                , line
                                , module.Layout.BitSizeOf(llvmType)
                                , alignment
                                , debugFlags
                                , derivedFrom
                                , elements
                                );
 }
Пример #2
0
 public DebugPointerType(IPointerType llvmPtrType, NativeModule module, DIType elementType, string name = null, uint alignment = 0)
     : base(llvmPtrType)
 {
     module.VerifyArgNotNull(nameof(module));
     DIType = module.DIBuilder
              .CreatePointerType(elementType
                                 , name
                                 , module.Layout.BitSizeOf(llvmPtrType)
                                 , alignment
                                 );
 }
Пример #3
0
 /// <summary>Constructs a new <see cref="DebugFunctionType"/></summary>
 /// <param name="llvmType">Native LLVM function signature</param>
 /// <param name="module"><see cref="NativeModule"/> to use when construction debug information</param>
 /// <param name="debugFlags"><see cref="DebugInfoFlags"/> for this signature</param>
 /// <param name="retType">Return type for the function</param>
 /// <param name="argTypes">Potentially empty set of argument types for the signature</param>
 public DebugFunctionType(IFunctionType llvmType
                          , NativeModule module
                          , DebugInfoFlags debugFlags
                          , DebugType <ITypeRef, DIType> retType
                          , params DebugType <ITypeRef, DIType>[] argTypes
                          )
     : base(llvmType.VerifyArgNotNull(nameof(llvmType)))
 {
     DIType = module.VerifyArgNotNull(nameof(module))
              .DIBuilder
              .CreateSubroutineType(debugFlags
                                    , retType.VerifyArgNotNull(nameof(retType)).DIType
                                    , argTypes.Select(t => t.DIType)
                                    );
 }
Пример #4
0
 public DebugStructType(NativeModule module
                        , string nativeName
                        , DIScope scope
                        , string name
                        , DIFile file = null
                        , uint line   = 0
                        )
     : this(module.VerifyArgNotNull(nameof(module)).Context.CreateStructType(nativeName)
            , module
            , scope
            , name
            , file
            , line
            )
 {
 }
Пример #5
0
 public DebugStructType(IStructType llvmType
                        , NativeModule module
                        , DIScope scope
                        , string name
                        , DIFile file
                        , uint line
                        )
     : base(llvmType)
 {
     DIType = module.VerifyArgNotNull(nameof(module))
              .DIBuilder
              .CreateReplaceableCompositeType(Tag.StructureType
                                              , name
                                              , scope
                                              , file
                                              , line
                                              );
 }
Пример #6
0
        public DebugStructType(NativeModule module
                               , string nativeName
                               , DIScope scope
                               , string name
                               , DIFile diFile
                               , uint line
                               , DebugInfoFlags debugFlags
                               , IEnumerable <DebugMemberInfo> debugElements
                               , DIType derivedFrom = null
                               , bool packed        = false
                               , uint?bitSize       = null
                               , uint bitAlignment  = 0
                               )
        {
            module.VerifyArgNotNull(nameof(module));
            DebugMembers = new ReadOnlyCollection <DebugMemberInfo>(debugElements as IList <DebugMemberInfo> ?? debugElements.ToList( ));

            NativeType = module.Context.CreateStructType(nativeName, packed, debugElements.Select(e => e.DebugType).ToArray( ));
            DIType     = module.DIBuilder.CreateReplaceableCompositeType(Tag.StructureType
                                                                         , name
                                                                         , scope
                                                                         , diFile
                                                                         , line
                                                                         );

            var memberTypes = from memberInfo in DebugMembers
                              select CreateMemberType(module, memberInfo);

            var concreteType = module.DIBuilder.CreateStructType(scope: scope
                                                                 , name: name
                                                                 , file: diFile
                                                                 , line: line
                                                                 , bitSize: bitSize ?? module.Layout.BitSizeOf(NativeType)
                                                                 , bitAlign: bitAlignment
                                                                 , debugFlags: debugFlags
                                                                 , derivedFrom: derivedFrom
                                                                 , elements: memberTypes
                                                                 );

            // assignment performs RAUW
            DIType = concreteType;
        }