Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gcc/clang version analysis improvements #1657

Merged
merged 4 commits into from
Feb 11, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ async function getClangVersion(binPath: string): Promise<ClangVersion|null> {
return null;
}
const lines = exec.stderr.split('\n');
const version_re = /^(?:Apple LLVM|.*clang) version ([^\s-]+)(?:[\s-]|$)/;
const versionWord: string = localize("version.word", "version");
andreeis marked this conversation as resolved.
Show resolved Hide resolved
const version_re_str: string = `^(?:Apple LLVM|.*clang) ${versionWord} ([^\\s-]+)(?:[\\s-]|$)`;
const version_re = RegExp(version_re_str, "mgi");
let version: string = "";
let fullVersion: string = "";
for (const line of lines) {
Expand Down Expand Up @@ -194,12 +196,14 @@ export async function kitIfCompiler(bin: string, pr?: ProgressReporter): Promise
}

const compiler_version_output = exec.stderr.trim().split('\n');
const version_re = /^gcc version (.*?) .*/;
const versionWord: string = localize("version.word", "version");
const version_re_str: string = `^gcc(-| )${versionWord} (.*?) .*`;
const version_re = RegExp(version_re_str, "mgi");
let version: string = "";
for (const line of compiler_version_output) {
const version_match = version_re.exec(line);
if (version_match !== null) {
version = version_match[1];
version = version_match[2];
break;
}
}
Expand Down