diff options
author | Juan José <soyjuanarbol@gmail.com> | 2022-05-20 09:15:03 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-20 16:15:03 +0200 |
commit | 86c6deacd5178c416fb559659e2cacaf1eecf03d (patch) | |
tree | 0cefd9dc72f699c7727747392fa50d8862f596e8 /lib/compilers/argument-parsers.js | |
parent | c9b2b81967f5d056796c83a78180c7a1b30210ae (diff) | |
download | compiler-explorer-86c6deacd5178c416fb559659e2cacaf1eecf03d.tar.gz compiler-explorer-86c6deacd5178c416fb559659e2cacaf1eecf03d.zip |
Make Clang parser logic shorter (#3692)gh-3020
Co-authored-by: Mats Larsen <me@supergrecko.com>
Diffstat (limited to 'lib/compilers/argument-parsers.js')
-rw-r--r-- | lib/compilers/argument-parsers.js | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/compilers/argument-parsers.js b/lib/compilers/argument-parsers.js index 10255df3e..98641f47a 100644 --- a/lib/compilers/argument-parsers.js +++ b/lib/compilers/argument-parsers.js @@ -132,29 +132,25 @@ export class GCCParser extends BaseParser { } export class ClangParser extends BaseParser { - static async setCompilerSettingsFromOptions(compiler, options) { + static setCompilerSettingsFromOptions(compiler, options) { logger.debug(`clang-like compiler options: ${_.keys(options).join(' ')}`); if (BaseParser.hasSupport(options, '-fsave-optimization-record')) { compiler.compiler.optArg = '-fsave-optimization-record'; compiler.compiler.supportsOptOutput = true; } - if (BaseParser.hasSupport(options, '-fcolor-diagnostics')) { - if (compiler.compiler.options) compiler.compiler.options += ' '; - compiler.compiler.options += '-fcolor-diagnostics'; - } if (BaseParser.hasSupport(options, '-emit-llvm')) { compiler.compiler.supportsIrView = true; compiler.compiler.irArg = ['-Xclang', '-emit-llvm', '-fsyntax-only']; } - if (BaseParser.hasSupport(options, '-fno-crash-diagnostics')) { - if (compiler.compiler.options) compiler.compiler.options += ' '; - compiler.compiler.options += '-fno-crash-diagnostics'; - } + + if (BaseParser.hasSupport(options, '-fcolor-diagnostics')) compiler.compiler.options += ' -fcolor-diagnostics'; + if (BaseParser.hasSupport(options, '-fno-crash-diagnostics')) + compiler.compiler.options += ' -fno-crash-diagnostics'; } static async parse(compiler) { const options = await ClangParser.getOptions(compiler, '--help'); - await this.setCompilerSettingsFromOptions(compiler, options); + this.setCompilerSettingsFromOptions(compiler, options); return compiler; } } |