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

Method updateOpenInQuickBench

static/panes/editor.ts:812–890  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

810 }
811
812 async updateOpenInQuickBench(): Promise<void> {
813 if (options.thirdPartyIntegrationEnabled) {
814 type QuickBenchState = {
815 text?: string;
816 compiler?: string;
817 optim?: string;
818 cppVersion?: string;
819 lib?: string;
820 };
821
822 const quickBenchState: QuickBenchState = {
823 text: this.getSource(),
824 };
825
826 const compilers = this.getCompilerStates();
827
828 for (const compiler of compilers) {
829 let knownCompiler = false;
830
831 const compilerExtInfo = unwrap(
832 await this.hub.compilerService.findCompiler(this.currentLanguage?.id ?? '', compiler.compiler),
833 );
834 const semver = this.cleanupSemVer(compilerExtInfo.semver);
835 let groupOrName = compilerExtInfo.baseName || compilerExtInfo.groupName || compilerExtInfo.name;
836 if (semver && groupOrName) {
837 groupOrName = groupOrName.toLowerCase();
838 if (groupOrName.includes('gcc')) {
839 quickBenchState.compiler = 'gcc-' + semver;
840 knownCompiler = true;
841 } else if (groupOrName.includes('clang')) {
842 quickBenchState.compiler = 'clang-' + semver;
843 knownCompiler = true;
844 }
845 }
846
847 if (knownCompiler) {
848 const match = compiler.options.match(/-(O([0-3sg]|fast))/);
849 if (match !== null) {
850 if (match[2] === 'fast') {
851 quickBenchState.optim = 'F';
852 } else {
853 quickBenchState.optim = match[2].toUpperCase();
854 }
855 }
856
857 if (
858 compiler.options.indexOf('-std=c++11') !== -1 ||
859 compiler.options.indexOf('-std=gnu++11') !== -1
860 ) {
861 quickBenchState.cppVersion = '11';
862 } else if (
863 compiler.options.indexOf('-std=c++14') !== -1 ||
864 compiler.options.indexOf('-std=gnu++14') !== -1
865 ) {
866 quickBenchState.cppVersion = '14';
867 } else if (
868 compiler.options.indexOf('-std=c++17') !== -1 ||
869 compiler.options.indexOf('-std=gnu++17') !== -1

Callers 1

registerButtonsMethod · 0.95

Calls 8

getSourceMethod · 0.95
getCompilerStatesMethod · 0.95
cleanupSemVerMethod · 0.95
asciiEncodeJsonTextMethod · 0.95
matchMethod · 0.80
toStringMethod · 0.80
unwrapFunction · 0.50
findCompilerMethod · 0.45

Tested by

no test coverage detected