MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / processAsm

Method processAsm

lib/compilers/hook.ts:82–113  ·  view source on GitHub ↗
(result, filters: ParseFiltersAndOutputOptions, options: string[])

Source from the content-addressed store, hash-verified

80 }
81
82 override async processAsm(result, filters: ParseFiltersAndOutputOptions, options: string[]) {
83 // Ignoring `trim` filter because it is not supported by Hook.
84 filters.trim = false;
85 const _result = await super.processAsm(result, filters, options);
86 const commentRegex = /^\s*;(.*)/;
87 const instructionRegex = /^\s{2}(\d+)(.*)/;
88 const asm = _result.asm;
89 let lastLineNo: number | null = null;
90 for (const item of asm) {
91 const text = item.text;
92 if (commentRegex.test(text)) {
93 item.source = {line: null, file: null};
94 lastLineNo = null;
95 continue;
96 }
97 const match = text.match(instructionRegex);
98 if (match) {
99 const lineNo = Number.parseInt(match[1], 10);
100 item.source = {line: lineNo, file: null};
101 lastLineNo = lineNo;
102 continue;
103 }
104 if (text) {
105 item.source = {line: lastLineNo, file: null};
106 continue;
107 }
108 item.source = {line: null, file: null};
109 lastLineNo = null;
110 }
111 _result.asm = asm;
112 return _result;
113 }
114}

Callers

nothing calls this directly

Calls 2

testMethod · 0.80
matchMethod · 0.80

Tested by

no test coverage detected