Skip to content

Commit b628260

Browse files
committed
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.
2 parents bb758cf + 1a44694 commit b628260

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)