MCPcopy Index your code
hub / github.com/compiler-explorer/compiler-explorer / process

Method process

lib/parsers/asm-parser-cpp.ts:36–76  ·  view source on GitHub ↗
(asmResult: string, filters: ParseFiltersAndOutputOptions)

Source from the content-addressed store, hash-verified

34
35export class AsmParserCpp implements IAsmParser {
36 process(asmResult: string, filters: ParseFiltersAndOutputOptions): ParsedAsmResult {
37 const startTime = process.hrtime.bigint();
38
39 const asm: {
40 text: string;
41 source: Source | null;
42 labels: InlineLabel[];
43 }[] = [];
44
45 let source: Source | null = null;
46 for (const line of utils.splitLines(asmResult)) {
47 let advance = true;
48 const match = line.match(lineRe);
49 if (match?.groups) {
50 // TODO perhaps we'll need to check the file here at some point in the future.
51 // TODO I've temporarily disabled this as the result is visually too noisy
52 // was: source = {file: null, line: parseInt(match.groups.line)};
53 source = {file: match.groups.file, line: Number.parseInt(match.groups.line, 10)};
54 if (filters.directives) {
55 continue;
56 }
57 advance = false;
58 }
59 asm.push({
60 text: line,
61 source: source,
62 labels: [],
63 });
64 if (source && advance) {
65 source = {...source, line: source.line + 1};
66 }
67 }
68
69 const endTime = process.hrtime.bigint();
70 return {
71 asm: asm,
72 labelDefinitions: {},
73 parsingTime: utils.deltaTimeNanoToMili(startTime, endTime),
74 filteredCount: 0,
75 };
76 }
77}

Callers

nothing calls this directly

Calls 3

splitLinesMethod · 0.80
matchMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected