Skip to content

Commit

Permalink
Rollup merge of rust-lang#102337 - cuviper:llvm-optional-bool, r=nikic
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Dylan-DPC authored Sep 27, 2022
2 parents 79de0e4 + 35adb36 commit fdf8751
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit fdf8751

Please sign in to comment.