Skip to content

Commit 35adb36

Browse files
committed
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.
1 parent 8b70583 commit 35adb36

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ extern "C" void LLVMRustSetModulePIELevel(LLVMModuleRef M) {
10441044
extern "C" void LLVMRustSetModuleCodeModel(LLVMModuleRef M,
10451045
LLVMRustCodeModel Model) {
10461046
auto CM = fromRust(Model);
1047-
if (!CM.hasValue())
1047+
if (!CM)
10481048
return;
10491049
unwrap(M)->setCodeModel(*CM);
10501050
}

0 commit comments

Comments
 (0)