// DataFlowAnalysis
        public static string GetDisplayString(BlockSyntax syntax, DataFlowAnalysis analysis)
        {
            var builder = new HierarchicalStringBuilder();

            using (builder.AppendTitle("Data flow analysis: {0}", syntax.Parent !.Kind())) {
                builder.AppendLine("Definitely assigned (On entry): {0}", analysis.DefinitelyAssignedOnEntry.Join());
                builder.AppendLine("Definitely assigned (On exit): {0}", analysis.DefinitelyAssignedOnExit.Join());

                builder.AppendLine("Declared (Inside): {0}", analysis.VariablesDeclared.Join());
                builder.AppendLine("Always assigned (Inside): {0}", analysis.AlwaysAssigned.Join());

                builder.AppendLine("Written (Outside): {0}", analysis.WrittenOutside.Join());
                builder.AppendLine("Read (Outside): {0}", analysis.ReadOutside.Join());

                builder.AppendLine("Written (Inside): {0}", analysis.WrittenInside.Join());
                builder.AppendLine("Read (Inside): {0}", analysis.ReadInside.Join());

                builder.AppendLine("Data flows (In): {0}", analysis.DataFlowsIn.Join());
                builder.AppendLine("Data flows (Out): {0}", analysis.DataFlowsOut.Join());

                builder.AppendLine("Captured: {0}", analysis.Captured.Join());
                builder.AppendLine("Captured (Inside): {0}", analysis.CapturedInside.Join());
                builder.AppendLine("Captured (Outside): {0}", analysis.CapturedOutside.Join());

                builder.AppendLine("Unsafe address taken: {0}", analysis.UnsafeAddressTaken.Join());
                builder.AppendLine("Used local functions: {0}", analysis.UsedLocalFunctions.Join());
            }
            return(builder.ToString());
        }
Example #2
0
        // Render/Text/Hierarchical
        public static string RenderToHierarchicalText(this ProjectArchNode project)
        {
            var builder = new HierarchicalStringBuilder();

            builder.AppendObject(project);
            return(builder.ToString());
        }
        // DependenciesAnalysis
        public static string GetDisplayString(SyntaxNode syntax, DependenciesAnalysis analysis)
        {
            var builder = new HierarchicalStringBuilder();

            using (builder.AppendTitle("Dependencies analysis:")) {
                builder.AppendHierarchy(syntax, analysis.References);
            }
            return(builder.ToString());
        }
Example #4
0
        // Analysis
        public static string GetMessage(Compilation compilation, DiagnosticAnalyzer[] analyzers, Diagnostic[] diagnostics)
        {
            var builder = new HierarchicalStringBuilder();

            using (builder.AppendTitle("Analysis result:")) {
                builder.AppendObject(compilation);
                builder.AppendObject(analyzers);
                builder.AppendObject(diagnostics);
            }
            return(builder.ToString());
        }
Example #5
0
        // Generation
        public static string GetMessage(ISourceGenerator generator, Compilation compilation, GeneratedSourceResult[] sources, Diagnostic[] diagnostics, Exception?exception)
        {
            var builder = new HierarchicalStringBuilder();

            using (builder.AppendTitle("Generation result:")) {
                builder.AppendLine("Generator: {0}", generator.GetType().Name);
                builder.AppendObject(compilation);
                builder.AppendObject(diagnostics);
                builder.AppendObject(exception);
                builder.AppendObject(sources);
            }
            return(builder.ToString());
        }
        // ControlFlowAnalysis
        public static string GetDisplayString(BlockSyntax syntax, ControlFlowAnalysis analysis)
        {
            var builder = new HierarchicalStringBuilder();

            using (builder.AppendTitle("Control flow analysis: {0}", syntax.Parent !.Kind())) {
                builder.AppendLine("Start point is reachable: {0}", analysis.StartPointIsReachable);
                builder.AppendLine("End point is reachable: {0}", analysis.EndPointIsReachable);

                builder.AppendLine("Entry points: {0}", analysis.EntryPoints.Join());
                builder.AppendLine("Exit points: {0}", analysis.ExitPoints.Join());

                builder.AppendLine("Return statements: {0}", analysis.ReturnStatements.Join());
            }
            return(builder.ToString());
        }
        // ControlFlowGraph
        public static string GetDisplayString(ControlFlowGraph graph)
        {
            var builder = new HierarchicalStringBuilder();

            using (builder.AppendTitle("Control flow graph:")) {
                builder.AppendProperty("Original operation", graph.OriginalOperation);
                builder.AppendSeparator();
                builder.AppendProperty("Root region", graph.Root);
                builder.AppendSeparator();
                foreach (var block in graph.Blocks)
                {
                    builder.AppendProperty("Block", block);
                    builder.AppendSeparator();
                }
            }
            return(builder.ToString());
        }