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

Method constructor

lib/base-compiler.ts:225–317  ·  view source on GitHub ↗
(compilerInfo: PreliminaryCompilerInfo & {disabledFilters?: string[]}, env: CompilationEnvironment)

Source from the content-addressed store, hash-verified

223 protected readonly isCompilationWorker: boolean;
224
225 constructor(compilerInfo: PreliminaryCompilerInfo & {disabledFilters?: string[]}, env: CompilationEnvironment) {
226 // Information about our compiler
227 // By the end of construction / initialise() everything will be populated for CompilerInfo
228 this.compiler = compilerInfo as CompilerInfo;
229 this.lang = languages[compilerInfo.lang];
230 if (!this.lang) {
231 throw new Error(`Missing language info for ${compilerInfo.lang}`);
232 }
233 this.compileFilename = `example${this.lang.extensions[0]}`;
234 this.env = env;
235 // Partial application of compilerProps with the proper language id applied to it
236 this.compilerProps = this.env.getCompilerPropsForLanguage(this.lang.id);
237 this.compiler.supportsIntel = !!this.compiler.intelAsm;
238
239 this.alwaysResetLdPath = this.env.ceProps('alwaysResetLdPath', false);
240 this.delayCleanupTemp = this.env.ceProps('delayCleanupTemp', false);
241 this.isCompilationWorker = this.env.ceProps('compilequeue.is_worker', false);
242 this.stubRe = new RegExp(this.compilerProps('stubRe', ''));
243 this.stubText = this.compilerProps('stubText', '');
244 this.compilerWrapper = this.compilerProps<string>('compiler-wrapper');
245
246 const executionEnvironmentClassStr = this.compilerProps<string>('executionEnvironmentClass', 'local');
247 this.executionEnvironmentClass = getExecutionEnvironmentByKey(executionEnvironmentClassStr);
248
249 if (!this.compiler.options) this.compiler.options = '';
250 if (!this.compiler.optArg) this.compiler.optArg = '';
251 if (!this.compiler.supportsOptOutput) this.compiler.supportsOptOutput = false;
252 if (!this.compiler.supportsVerboseAsm) this.compiler.supportsVerboseAsm = false;
253
254 if (!compilerInfo.disabledFilters) this.compiler.disabledFilters = [];
255 else if (typeof (this.compiler.disabledFilters as any) === 'string') {
256 // When first loaded from props it may be a string so we split it here
257 // I'd like a better way to do this that doesn't involve type hacks
258 // TODO(jeremy-rifkin): branch may now be obsolete?
259 this.compiler.disabledFilters = (this.compiler.disabledFilters as any).split(',');
260 }
261
262 const demanglerExe = this.compiler.demangler;
263 if (demanglerExe && this.compiler.demanglerType) {
264 this.demanglerClass = getDemanglerTypeByKey(this.compiler.demanglerType);
265 }
266 const objdumperExe = this.compiler.objdumper;
267 if (objdumperExe && this.compiler.objdumperType) {
268 this.objdumperClass = getObjdumperTypeByKey(this.compiler.objdumperType);
269 }
270
271 this.asm = new AsmParser(this.compilerProps);
272 this.llvmIrDemanglerClass = this.demanglerClass ?? BaseDemangler;
273 const irDemangler = new LLVMIRDemangler(new this.llvmIrDemanglerClass(this.compiler.demangler, this));
274 this.llvmIr = new LlvmIrParser(this.compilerProps, irDemangler);
275 this.llvmPassDumpParser = new LlvmPassDumpParser();
276 this.llvmAst = new LlvmAstParser(this.compilerProps);
277
278 this.toolchainPath = getToolchainPath(this.compiler.exe, this.compiler.options);
279
280 this.possibleArguments = new CompilerArguments(this.compiler.id);
281 this.possibleTools = _.values(compilerInfo.tools) as ITool[];
282

Callers

nothing calls this directly

Calls 5

getRemoteMethod · 0.95
getToolchainPathFunction · 0.85

Tested by

no test coverage detected