about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-04-22 20:03:44 +0000
committerbors <bors@rust-lang.org>2023-04-22 20:03:44 +0000
commitb628260df0587ae559253d8640ecb8738d3de613 (patch)
tree270e14f5ab8f5716972bdbb4e1b43ffe8e667199
parentbb758cfc6d773b15af5bf65330ea7c36d7c3673d (diff)
parent1a446947133c6dc39db8c9dd65a6aebd217e067d (diff)
downloadrust-b628260df0587ae559253d8640ecb8738d3de613.tar.gz
rust-b628260df0587ae559253d8640ecb8738d3de613.zip
Auto merge of #110523 - ecnelises:llvm_isa_fix, r=cuviper
Replace LLVM any_isa with any_cast

Per https://github.com/rust-lang/llvm-project/blob/585a6eb3ebf7c40fd7c1b23e3ece557b3cc2aa36/llvm/include/llvm/ADT/Any.h#L130 , `any_isa` has been deprecated in LLVM. Use `any_cast` instead to avoid warnings.
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
index c9acbab253e..abbe8e59770 100644
--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
@@ -523,14 +523,14 @@ extern "C" typedef void (*LLVMRustSelfProfileBeforePassCallback)(void*, // LlvmS
 extern "C" typedef void (*LLVMRustSelfProfileAfterPassCallback)(void*); // LlvmSelfProfiler
 
 std::string LLVMRustwrappedIrGetName(const llvm::Any &WrappedIr) {
-  if (any_isa<const Module *>(WrappedIr))
-    return any_cast<const Module *>(WrappedIr)->getName().str();
-  if (any_isa<const Function *>(WrappedIr))
-    return any_cast<const Function *>(WrappedIr)->getName().str();
-  if (any_isa<const Loop *>(WrappedIr))
-    return any_cast<const Loop *>(WrappedIr)->getName().str();
-  if (any_isa<const LazyCallGraph::SCC *>(WrappedIr))
-    return any_cast<const LazyCallGraph::SCC *>(WrappedIr)->getName();
+  if (const auto *Cast = any_cast<const Module *>(&WrappedIr))
+    return (*Cast)->getName().str();
+  if (const auto *Cast = any_cast<const Function *>(&WrappedIr))
+    return (*Cast)->getName().str();
+  if (const auto *Cast = any_cast<const Loop *>(&WrappedIr))
+    return (*Cast)->getName().str();
+  if (const auto *Cast = any_cast<const LazyCallGraph::SCC *>(&WrappedIr))
+    return (*Cast)->getName();
   return "<UNKNOWN>";
 }