cranelift: Correctly recover from parsing unknown values (#4447)

When parsing isa specific values we were accidentally discarding the
value of the flag, and treating it always as a boolean flag.

This would cause a `clif-util` invocation such as
`cargo run -- compile -D --set has_sse41=false --target x86_64 test.clif`

to be interpreted as `--set has_sse41` and enable that feature instead
of disabling it.
This commit is contained in:
Afonso Bordado
2022-07-14 21:07:58 +01:00
committed by GitHub
parent f7767eb352
commit fc72b7ccd3
2 changed files with 23 additions and 1 deletions

View File

@@ -64,6 +64,9 @@ pub fn parse_sets_and_triple(
Err(ParseOptionError::UnknownFlag { name, .. }) => {
unknown_settings.push(name);
}
Err(ParseOptionError::UnknownValue { name, value, .. }) => {
unknown_settings.push(format!("{}={}", name, value));
}
Err(ParseOptionError::Generic(err)) => return Err(err.into()),
Ok(()) => {}
}