• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SamboyCoding / Cpp2IL / 17216182984

25 Aug 2025 05:35PM UTC coverage: 30.38% (-4.0%) from 34.352%
17216182984

Pull #481

github

web-flow
Merge b82763a24 into d5260685f
Pull Request #481: Decompiler

1804 of 7561 branches covered (23.86%)

Branch coverage included in aggregate %.

100 of 1839 new or added lines in 29 files covered. (5.44%)

41 existing lines in 6 files now uncovered.

4093 of 11850 relevant lines covered (34.54%)

165575.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

65.31
/Cpp2IL.Core/Graphs/Block.cs
1
using System.Collections.Generic;
2
using System.Linq;
3
using System.Text;
4
using Cpp2IL.Core.ISIL;
5

6
namespace Cpp2IL.Core.Graphs;
7

8
public class Block
9
{
10
    public BlockType BlockType { get; set; } = BlockType.Unknown;
238✔
11
    public List<Block> Predecessors = [];
56✔
12
    public List<Block> Successors = [];
56✔
13

14
    public List<object> Use = [];
56✔
15
    public List<object> Def = [];
56✔
16

17
    public List<Instruction> Instructions = [];
56✔
18

19
    public int ID { get; set; } = -1;
128✔
20

21
    public bool Dirty { get; set; }
108✔
22
    public bool Visited = false;
23

24
    public override string ToString()
25
    {
26
        StringBuilder stringBuilder = new StringBuilder();
×
NEW
27
        stringBuilder.AppendLine($"{BlockType} {ID}");
×
28
        stringBuilder.AppendLine();
×
NEW
29
        foreach (var instruction in Instructions)
×
30
        {
31
            stringBuilder.AppendLine(instruction.ToString());
×
32
        }
33

34
        return stringBuilder.ToString();
×
35
    }
36

37
    public void AddInstruction(Instruction instruction) => Instructions.Add(instruction);
146✔
38

39
    public void CalculateBlockType()
40
    {
41
        if (Instructions.Count <= 0)
40!
NEW
42
            return;
×
43

44
        var instruction = Instructions.Last();
40✔
45

46
        BlockType = instruction.OpCode switch
40!
47
        {
40✔
NEW
48
            OpCode.Jump => BlockType.OneWay,
×
49
            OpCode.ConditionalJump => BlockType.TwoWay,
16✔
NEW
50
            OpCode.IndirectJump => BlockType.NWay,
×
51
            OpCode.Call or OpCode.CallVoid => BlockType.Call,
22✔
52
            OpCode.Return => BlockType.Return,
2✔
NEW
53
            _ => BlockType.Fall,
×
54
        };
40✔
55

56
        if (BlockType == BlockType.Call && Successors.Count > 0)
40✔
57
        {
58
            if (Successors[0].BlockType == BlockType.Exit)
22✔
59
                BlockType = BlockType.TailCall;
4✔
60
        }
61
    }
40✔
62
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc