about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2022-09-26 16:51:18 -0700
committerJosh Stone <jistone@redhat.com>2022-09-26 16:51:18 -0700
commit35adb367798476eb49d3e77d44999b5f8ce8fa34 (patch)
tree67789670b851446077bd696c8c8cbf0db5e5cb5f /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
parent8b705839cd656d202e920efa8769cbe43a5ee269 (diff)
downloadrust-35adb367798476eb49d3e77d44999b5f8ce8fa34.tar.gz
rust-35adb367798476eb49d3e77d44999b5f8ce8fa34.zip
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.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
index 09f377d349f..879a3b660b4 100644
--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
@@ -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);
 }