virtual public void visit(AST.Block block) { foreach (var statement in block.statements) { statement.accept(this); } }
int GetDILexicalBlock(AST.Block block) { if (!debugInfoScopeLookup.TryGetValue(block, out int lexicalBlockIdx)) { var scopeIdx = GetDIScope(block.scope.parent.owner); var nodeString = $"distinct !DILexicalBlock(scope: !{scopeIdx}, file: !{GetDIFile(block)}, line: {block.token.Line}, column: {block.token.Pos})"; lexicalBlockIdx = AddDebugInfoNode(nodeString); } return(lexicalBlockIdx); }
int GetDISubprogram(AST.FunctionDefinition fd) { if (fd.body == null) { return(-1); } if (!debugInfoScopeLookup.TryGetValue(fd, out int subprogramIdx)) { AST.Block block = (AST.Block)fd.body; var ft = typeChecker.GetNodeType(fd); var variablesIdx = AddDebugInfoNode("!{}"); string nodeString = $"distinct !DISubprogram(name: \"{fd.funName}\", linkageName: \"{fd.funName}\", file: !{GetDIFile(block)}, line: {fd.token.Line}, type: !{GetDIType(ft, true)}, isLocal: true, isDefinition: true, scopeLine: {block.token.Line}, flags: DIFlagPrototyped, isOptimized: false, unit: !{debugInfoCompileUnitIdx}, retainedNodes: !{variablesIdx})"; subprogramIdx = AddDebugInfoNode(nodeString); debugInfoScopeLookup.Add(fd, subprogramIdx); } return(subprogramIdx); }