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

Method parseFiles

lib/compilers/odin.ts:233–253  ·  view source on GitHub ↗
(asmLines: string[])

Source from the content-addressed store, hash-verified

231 }
232
233 parseFiles(asmLines: string[]) {
234 const files: Record<number, string> = {};
235 const fileFind = /^\s*\.(?:cv_)?file\s+(\d+)\s+"([^"]+)"(\s+"([^"]+)")?.*/;
236 for (const line of asmLines) {
237 const match = line.match(fileFind);
238 if (match) {
239 const lineNum = Number.parseInt(match[1], 10);
240 if (match[4] && !line.includes('.cv_file')) {
241 // Clang-style file directive '.file X "dir" "filename"'
242 if (match[4].startsWith('/')) {
243 files[lineNum] = match[4];
244 } else {
245 files[lineNum] = match[2] + '/' + match[4];
246 }
247 } else {
248 files[lineNum] = match[2];
249 }
250 }
251 }
252 return files;
253 }
254
255 removeNonMainSourceFunctions(asmLines: string[]): string[] {
256 const files = this.parseFiles(asmLines);

Callers 1

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected