Esempio n. 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="disposing"></param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         DIScope?.Dispose();
         DIScope = null;
     }
     base.Dispose(disposing);
 }
        private void EmitLocation(IAstNode node)
        {
            DIScope scope = Module.DICompileUnit;

            if (LexicalBlocks.Count > 0)
            {
                scope = LexicalBlocks.Peek( );
            }

            InstructionBuilder.SetDebugLocation(( uint )node.Location.StartLine, ( uint )node.Location.StartColumn, scope);
        }
Esempio n. 3
0
        /// <summary>Creates a Function definition with Debug information</summary>
        /// <param name="scope">Containing scope for the function</param>
        /// <param name="name">Name of the function in source language form</param>
        /// <param name="linkageName">Mangled linker visible name of the function (may be same as <paramref name="name"/> if mangling not required by source language</param>
        /// <param name="file">File containing the function definition</param>
        /// <param name="line">Line number of the function definition</param>
        /// <param name="signature">LLVM Function type for the signature of the function</param>
        /// <param name="isLocalToUnit">Flag to indicate if this function is local to the compilation unit</param>
        /// <param name="isDefinition">Flag to indicate if this is a definition</param>
        /// <param name="scopeLine">First line of the function's outermost scope, this may not be the same as the first line of the function definition due to source formatting</param>
        /// <param name="debugFlags">Additional flags describing this function</param>
        /// <param name="isOptimized">Flag to indicate if this function is optimized</param>
        /// <param name="tParam">Parameter Metadata node</param>
        /// <param name="decl">Declaration Metadata node</param>
        /// <returns>Function described by the arguments</returns>
        public Function CreateFunction(DIScope scope
                                       , string name
                                       , string linkageName
                                       , DIFile file
                                       , uint line
                                       , DebugFunctionType signature
                                       , bool isLocalToUnit
                                       , bool isDefinition
                                       , uint scopeLine
                                       , DebugInfoFlags debugFlags
                                       , bool isOptimized
                                       , [CanBeNull] MDNode tParam = null
                                       , [CanBeNull] MDNode decl   = null
                                       )
        {
            ValidateHandle( );
            scope.ValidateNotNull(nameof(scope));
            name.ValidateNotNullOrWhiteSpace(nameof(name));
            signature.ValidateNotNull(nameof(signature));
            if (signature.DIType == null)
            {
                throw new ArgumentException("Signature requires debug type information", nameof(signature));
            }

            var func        = AddFunction(linkageName ?? name, signature);
            var diSignature = signature.DIType;
            var diFunc      = DIBuilder.CreateFunction(scope: scope
                                                       , name: name
                                                       , mangledName: linkageName
                                                       , file: file
                                                       , line: line
                                                       , signatureType: diSignature
                                                       , isLocalToUnit: isLocalToUnit
                                                       , isDefinition: isDefinition
                                                       , scopeLine: scopeLine
                                                       , debugFlags: debugFlags
                                                       , isOptimized: isOptimized
                                                       , function: func
                                                       , typeParameter: tParam
                                                       , declaration: decl
                                                       );

            Debug.Assert(diFunc.Describes(func), "Expected to get a debug function that describes the provided function");
            func.DISubProgram = diFunc;
            return(func);
        }
Esempio n. 4
0
        private void EmitLocation(ParserRuleContext context)
        {
            if (context == null)
            {
                InstructionBuilder.SetDebugLocation(0, 0);
            }
            else
            {
                DIScope scope = Module.DICompileUnit;
                if (LexicalBlocks.Count > 0)
                {
                    scope = LexicalBlocks.Peek( );
                }

                InstructionBuilder.SetDebugLocation(( uint )context.Start.Line, ( uint )context.Start.Column, scope);
            }
        }
Esempio n. 5
0
 public IoCScope(DIScope dIScope)
 {
     _dIScope = dIScope;
 }