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

SamboyCoding / Cpp2IL / 10546805547

25 Aug 2024 12:11PM UTC coverage: 25.659% (+0.3%) from 25.343%
10546805547

push

github

gompoc
Core.Tests: Add another graph test case/cleanup

1108 of 5823 branches covered (19.03%)

Branch coverage included in aggregate %.

0 of 1 new or added line in 1 file covered. (0.0%)

2893 of 9770 relevant lines covered (29.61%)

58818.12 hits per line

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

0.0
/Cpp2IL.Core/Graphs/Processors/MetadataProcessor.cs
1
using System.Linq;
2
using Cpp2IL.Core.ISIL;
3
using Cpp2IL.Core.Model.Contexts;
4
using Cpp2IL.Core.Utils;
5
using LibCpp2IL;
6

7
namespace Cpp2IL.Core.Graphs.Processors;
8

9
internal class MetadataProcessor : IBlockProcessor
10
{
11
    public void Process(MethodAnalysisContext methodAnalysisContext, Block block)
12
    {
13
        foreach (var instruction in block.isilInstructions)
×
14
        {
15
            // TODO: Check if it shows up in any other
16
            if (instruction.OpCode != InstructionSetIndependentOpCode.Move)
×
17
            {
18
                continue;
19
            }
20

21
            if (instruction.Operands[0].Type != InstructionSetIndependentOperand.OperandType.Register || instruction.Operands[1].Type != InstructionSetIndependentOperand.OperandType.Memory)
×
22
            {
23
                continue;
24
            }
25

26
            var memoryOp = (IsilMemoryOperand)instruction.Operands[1].Data;
×
27
            if (memoryOp.Base == null && memoryOp.Index == null && memoryOp.Scale == 0)
×
28
            {
29
                var val = LibCpp2IlMain.GetLiteralByAddress((ulong)memoryOp.Addend);
×
30
                if (val == null)
×
31
                {
32
                    // Try instead check if its type metadata usage
33
                    var metadataUsage = LibCpp2IlMain.GetTypeGlobalByAddress((ulong)memoryOp.Addend);
×
NEW
34
                    if (metadataUsage != null && methodAnalysisContext.DeclaringType is not null)
×
35
                    {
36
                        var typeAnalysisContext = metadataUsage.ToContext(methodAnalysisContext.DeclaringType!.DeclaringAssembly);
×
37
                        if (typeAnalysisContext != null)
×
38
                            instruction.Operands[1] = InstructionSetIndependentOperand.MakeTypeMetadataUsage(typeAnalysisContext);
×
39
                    }
40

41
                    continue;
×
42
                }
43

44
                instruction.Operands[1] = InstructionSetIndependentOperand.MakeImmediate(val);
×
45
            }
46
        }
47
    }
×
48
}
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

© 2026 Coveralls, Inc