Skip to content

Commit 1a44694

Browse files
committed
Remove deprecated LLVM any_isa
1 parent b9fd498 commit 1a44694

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -523,14 +523,14 @@ extern "C" typedef void (*LLVMRustSelfProfileBeforePassCallback)(void*, // LlvmS
523523
extern "C" typedef void (*LLVMRustSelfProfileAfterPassCallback)(void*); // LlvmSelfProfiler
524524

525525
std::string LLVMRustwrappedIrGetName(const llvm::Any &WrappedIr) {
526-
if (any_isa<const Module *>(WrappedIr))
527-
return any_cast<const Module *>(WrappedIr)->getName().str();
528-
if (any_isa<const Function *>(WrappedIr))
529-
return any_cast<const Function *>(WrappedIr)->getName().str();
530-
if (any_isa<const Loop *>(WrappedIr))
531-
return any_cast<const Loop *>(WrappedIr)->getName().str();
532-
if (any_isa<const LazyCallGraph::SCC *>(WrappedIr))
533-
return any_cast<const LazyCallGraph::SCC *>(WrappedIr)->getName();
526+
if (const auto *Cast = any_cast<const Module *>(&WrappedIr))
527+
return (*Cast)->getName().str();
528+
if (const auto *Cast = any_cast<const Function *>(&WrappedIr))
529+
return (*Cast)->getName().str();
530+
if (const auto *Cast = any_cast<const Loop *>(&WrappedIr))
531+
return (*Cast)->getName().str();
532+
if (const auto *Cast = any_cast<const LazyCallGraph::SCC *>(&WrappedIr))
533+
return (*Cast)->getName();
534534
return "<UNKNOWN>";
535535
}
536536

0 commit comments

Comments
 (0)