MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / doCompilation

Method doCompilation

lib/base-compiler.ts:2565–2751  ·  view source on GitHub ↗
(
        inputFilename: string,
        dirPath: string,
        key: CacheKey,
        options: string[],
        filters: ParseFiltersAndOutputOptions,
        backendOptions: Record<string, any>,
        libraries: SelectedLibraryVersion[],
        tools: ActiveTool[],
    )

Source from the content-addressed store, hash-verified

2563 }
2564
2565 async doCompilation(
2566 inputFilename: string,
2567 dirPath: string,
2568 key: CacheKey,
2569 options: string[],
2570 filters: ParseFiltersAndOutputOptions,
2571 backendOptions: Record<string, any>,
2572 libraries: SelectedLibraryVersion[],
2573 tools: ActiveTool[],
2574 ): Promise<[any, OptRemark[], StackUsage.StackUsageInfo[]]> {
2575 const inputFilenameSafe = this.filename(inputFilename);
2576
2577 const outputFilename = this.getOutputFilename(dirPath, this.outputFilebase, key);
2578
2579 const overrides = this.sanitizeCompilerOverrides(backendOptions.overrides || []);
2580
2581 const downloads = await this.setupBuildEnvironment(key, dirPath, !!filters.binary || !!filters.binaryObject);
2582
2583 options = _.compact(
2584 this.prepareArguments(
2585 options,
2586 filters,
2587 backendOptions,
2588 inputFilename,
2589 outputFilename,
2590 libraries,
2591 overrides,
2592 ),
2593 );
2594
2595 const execOptions = this.getDefaultExecOptions();
2596 execOptions.ldPath = this.getSharedLibraryPathsAsLdLibraryPaths([], dirPath);
2597
2598 this.applyOverridesToExecOptions(execOptions, overrides);
2599
2600 const makeAst = backendOptions.produceAst && this.compiler.supportsAstView;
2601 const makePp = backendOptions.producePp && this.compiler.supportsPpView;
2602 const makeGnatDebug = backendOptions.produceGnatDebug && this.compiler.supportsGnatDebugViews;
2603 const makeGnatDebugTree = backendOptions.produceGnatDebugTree && this.compiler.supportsGnatDebugViews;
2604 const makeIr = backendOptions.produceIr && this.compiler.supportsIrView;
2605 const makeClangir = backendOptions.produceClangir && this.compiler.supportsClangirView;
2606 const makeClojureMacroExp = backendOptions.produceClojureMacroExp && this.compiler.supportsClojureMacroExpView;
2607 const makeOptPipeline = backendOptions.produceOptPipeline && this.compiler.optPipeline;
2608 const makeRustMir = backendOptions.produceRustMir && this.compiler.supportsRustMirView;
2609 const makeRustMacroExp = backendOptions.produceRustMacroExp && this.compiler.supportsRustMacroExpView;
2610 const makeRustHir = backendOptions.produceRustHir && this.compiler.supportsRustHirView;
2611 const makeHaskellCore = backendOptions.produceHaskellCore && this.compiler.supportsHaskellCoreView;
2612 const makeHaskellStg = backendOptions.produceHaskellStg && this.compiler.supportsHaskellStgView;
2613 const makeHaskellCmm = backendOptions.produceHaskellCmm && this.compiler.supportsHaskellCmmView;
2614 const makeLeanC = !!backendOptions.produceLeanC && this.compiler.supportsLeanCView;
2615 const makeGccDump = backendOptions.produceGccDump?.opened && this.compiler.supportsGccDump;
2616 const makeYul = backendOptions.produceYul && this.compiler.supportsYulView;
2617
2618 const [
2619 asmResult,
2620 astResult,
2621 ppResult,
2622 irResult,

Callers 1

compileMethod · 0.95

Calls 15

filenameMethod · 0.95
getOutputFilenameMethod · 0.95
setupBuildEnvironmentMethod · 0.95
prepareArgumentsMethod · 0.95
getDefaultExecOptionsMethod · 0.95
runCompilerMethod · 0.95
generateASTMethod · 0.95
generatePPMethod · 0.95
generateIRMethod · 0.95

Tested by

no test coverage detected