1
Fork 0

Remove deprecated LLVM any_isa

This commit is contained in:
Qiu Chaofan 2023-04-19 12:54:03 +08:00
parent b9fd498fa7
commit 1a44694713

View file

@ -523,14 +523,14 @@ extern "C" typedef void (*LLVMRustSelfProfileBeforePassCallback)(void*, // LlvmS
extern "C" typedef void (*LLVMRustSelfProfileAfterPassCallback)(void*); // LlvmSelfProfiler extern "C" typedef void (*LLVMRustSelfProfileAfterPassCallback)(void*); // LlvmSelfProfiler
std::string LLVMRustwrappedIrGetName(const llvm::Any &WrappedIr) { std::string LLVMRustwrappedIrGetName(const llvm::Any &WrappedIr) {
if (any_isa<const Module *>(WrappedIr)) if (const auto *Cast = any_cast<const Module *>(&WrappedIr))
return any_cast<const Module *>(WrappedIr)->getName().str(); return (*Cast)->getName().str();
if (any_isa<const Function *>(WrappedIr)) if (const auto *Cast = any_cast<const Function *>(&WrappedIr))
return any_cast<const Function *>(WrappedIr)->getName().str(); return (*Cast)->getName().str();
if (any_isa<const Loop *>(WrappedIr)) if (const auto *Cast = any_cast<const Loop *>(&WrappedIr))
return any_cast<const Loop *>(WrappedIr)->getName().str(); return (*Cast)->getName().str();
if (any_isa<const LazyCallGraph::SCC *>(WrappedIr)) if (const auto *Cast = any_cast<const LazyCallGraph::SCC *>(&WrappedIr))
return any_cast<const LazyCallGraph::SCC *>(WrappedIr)->getName(); return (*Cast)->getName();
return "<UNKNOWN>"; return "<UNKNOWN>";
} }