compiletest::header

Function extract_llvm_version

Source
pub fn extract_llvm_version(version: &str) -> Version
Expand description

Given an llvm version string that looks like 1.2.3-rc1, extract as semver. Note that this accepts more than just strict semver syntax (as in major.minor.patch); this permits omitting minor and patch version components so users can write e.g. //@ min-llvm-version: 19 instead of having to write //@ min-llvm-version: 19.0.0.

Currently panics if the input string is malformed, though we really should not use panic as an error handling strategy.

FIXME(jieyouxu): improve error handling