Rollup merge of #102337 - cuviper:llvm-optional-bool, r=nikic

Avoid LLVM-deprecated `Optional::hasValue`

LLVM 15 added `Optional::has_value`, and LLVM `main` (16) has deprecated
`hasValue`. However, its `explicit operator bool` does the same thing,
and was added long ago, so we can use that across our full LLVM range of
compatibility.
This commit is contained in:
Matthias Krüger 2022-09-27 21:42:24 +02:00 committed by GitHub
commit e1fb698c44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1044,7 +1044,7 @@ extern "C" void LLVMRustSetModulePIELevel(LLVMModuleRef M) {
extern "C" void LLVMRustSetModuleCodeModel(LLVMModuleRef M,
LLVMRustCodeModel Model) {
auto CM = fromRust(Model);
if (!CM.hasValue())
if (!CM)
return;
unwrap(M)->setCodeModel(*CM);
}