| 185 | } |
| 186 | |
| 187 | export class BaseCompiler { |
| 188 | public compiler: CompilerInfo; |
| 189 | public lang: Language; |
| 190 | protected compileFilename: string; |
| 191 | protected env: CompilationEnvironment; |
| 192 | protected compilerProps: PropertyGetter; |
| 193 | protected alwaysResetLdPath: boolean; |
| 194 | protected delayCleanupTemp: boolean; |
| 195 | protected stubRe: RegExp; |
| 196 | protected stubText: string; |
| 197 | protected compilerWrapper: string | undefined; |
| 198 | protected asm: IAsmParser; |
| 199 | protected llvmIrDemanglerClass: typeof BaseDemangler; |
| 200 | protected llvmIr: LlvmIrParser; |
| 201 | protected llvmPassDumpParser: LlvmPassDumpParser; |
| 202 | protected llvmAst: LlvmAstParser; |
| 203 | protected toolchainPath: string | undefined; |
| 204 | public possibleArguments: CompilerArguments; |
| 205 | protected possibleTools: ITool[]; |
| 206 | protected demanglerClass: typeof BaseDemangler | null = null; |
| 207 | protected objdumperClass!: new () => BaseObjdumper; |
| 208 | public outputFilebase: string; |
| 209 | protected mtime: Date | null = null; |
| 210 | protected cmakeBaseEnv: Record<string, string>; |
| 211 | protected buildenvsetup: null | any; |
| 212 | protected externalparser: null | IExternalParser; |
| 213 | protected supportedLibraries?: Record<string, OptionsHandlerLibrary>; |
| 214 | protected packager: Packager; |
| 215 | protected defaultRpathFlag = '-Wl,-rpath,'; |
| 216 | private static objdumpAndParseCounter = new PromClient.Counter({ |
| 217 | name: 'ce_objdumpandparsetime_total', |
| 218 | help: 'Time spent on objdump and parsing of objdumps', |
| 219 | labelNames: [], |
| 220 | }); |
| 221 | protected executionEnvironmentClass: typeof LocalExecutionEnvironment; |
| 222 | protected readonly argParser: BaseParser; |
| 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'); |
nothing calls this directly
no outgoing calls
no test coverage detected