(compilationRes: CompilationResult)
| 3587 | } |
| 3588 | |
| 3589 | async processOptOutput(compilationRes: CompilationResult): Promise<OptRemark[]> { |
| 3590 | // The distinction between clang and gcc opt remarks is a bit ad-hoc. A cleaner way might have been |
| 3591 | // to override processOptOutput in ClangCompiler and GCCCompiler, but that would have required having |
| 3592 | // all llvm-based compilers inherit ClangCompiler and all gcc-based ones inherit GCCCompiler. |
| 3593 | // Might be a good idea to refactor this some day. |
| 3594 | |
| 3595 | if (!compilationRes.optPath) return []; |
| 3596 | |
| 3597 | const optRemarksRaw = await fs.readFile(compilationRes.optPath, 'utf8'); |
| 3598 | const remarks = this.processRawOptRemarks(optRemarksRaw, this.compileFilename); |
| 3599 | |
| 3600 | if (remarks.length > 0 && this.compiler.demangler) { |
| 3601 | const result = JSON.stringify(remarks, null, 4); |
| 3602 | const demangleResult: UnprocessedExecResult = await this.exec( |
| 3603 | this.compiler.demangler, |
| 3604 | [...this.compiler.demanglerArgs, '-n'], |
| 3605 | {input: result}, |
| 3606 | ); |
| 3607 | if (demangleResult.stdout.length > 0 && !demangleResult.truncated) { |
| 3608 | try { |
| 3609 | return JSON.parse(demangleResult.stdout) as OptRemark[]; |
| 3610 | } catch (exception) { |
| 3611 | // swallow exception and return non-demangled output |
| 3612 | logger.warn(`Caught exception ${exception} during opt demangle parsing`); |
| 3613 | } |
| 3614 | } |
| 3615 | } |
| 3616 | return remarks; |
| 3617 | } |
| 3618 | |
| 3619 | async processStackUsageOutput(suPath: string): Promise<StackUsage.StackUsageInfo[]> { |
| 3620 | const output = StackUsage.parse(await fs.readFile(suPath, 'utf8')); |
no test coverage detected