aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/Debugify.cpp
diff options
context:
space:
mode:
authorSebastian Neubauer <Sebastian.Neubauer@amd.com>2022-12-08 12:06:44 +0100
committerSebastian Neubauer <Sebastian.Neubauer@amd.com>2022-12-08 12:07:30 +0100
commit19158eb7f06d7ed4a834a35a3afa6bda2685a05b (patch)
treee4bff9f621a05f2fdcd1a8c843a13abe0adf1baf /llvm/lib/Transforms/Utils/Debugify.cpp
parent3a9e07b1e7f4718a0e117f3a732f1679c4bf2e30 (diff)
downloadllvm-19158eb7f06d7ed4a834a35a3afa6bda2685a05b.zip
llvm-19158eb7f06d7ed4a834a35a3afa6bda2685a05b.tar.gz
llvm-19158eb7f06d7ed4a834a35a3afa6bda2685a05b.tar.bz2
Revert "[llvm] Replace llvm::Any with std::any"
msvc fails to link when using any_cast. This seems to be fixed recently only. https://developercommunity.visualstudio.com/t/stdany-doesnt-link-when-exceptions-are-disabled/376072 This reverts commit aeac2e4884a3ce62c920cd51806a9396da64d9f7.
Diffstat (limited to 'llvm/lib/Transforms/Utils/Debugify.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Debugify.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp
index 0baae37..f4d9bce 100644
--- a/llvm/lib/Transforms/Utils/Debugify.cpp
+++ b/llvm/lib/Transforms/Utils/Debugify.cpp
@@ -29,8 +29,6 @@
#include "llvm/Support/JSON.h"
#include <optional>
-#include <any>
-
#define DEBUG_TYPE "debugify"
using namespace llvm;
@@ -1030,22 +1028,22 @@ static bool isIgnoredPass(StringRef PassID) {
void DebugifyEachInstrumentation::registerCallbacks(
PassInstrumentationCallbacks &PIC) {
- PIC.registerBeforeNonSkippedPassCallback([this](StringRef P, std::any IR) {
+ PIC.registerBeforeNonSkippedPassCallback([this](StringRef P, Any IR) {
if (isIgnoredPass(P))
return;
- if (const auto **F = std::any_cast<const Function *>(&IR))
- applyDebugify(*const_cast<Function *>(*F),
+ if (any_isa<const Function *>(IR))
+ applyDebugify(*const_cast<Function *>(any_cast<const Function *>(IR)),
Mode, DebugInfoBeforePass, P);
- else if (const auto **M = std::any_cast<const Module *>(&IR))
- applyDebugify(*const_cast<Module *>(*M),
+ else if (any_isa<const Module *>(IR))
+ applyDebugify(*const_cast<Module *>(any_cast<const Module *>(IR)),
Mode, DebugInfoBeforePass, P);
});
- PIC.registerAfterPassCallback([this](StringRef P, std::any IR,
+ PIC.registerAfterPassCallback([this](StringRef P, Any IR,
const PreservedAnalyses &PassPA) {
if (isIgnoredPass(P))
return;
- if (const auto **CF = std::any_cast<const Function *>(&IR)) {
- auto &F = *const_cast<Function *>(*CF);
+ if (any_isa<const Function *>(IR)) {
+ auto &F = *const_cast<Function *>(any_cast<const Function *>(IR));
Module &M = *F.getParent();
auto It = F.getIterator();
if (Mode == DebugifyMode::SyntheticDebugInfo)
@@ -1056,8 +1054,8 @@ void DebugifyEachInstrumentation::registerCallbacks(
M, make_range(It, std::next(It)), *DebugInfoBeforePass,
"CheckModuleDebugify (original debuginfo)",
P, OrigDIVerifyBugsReportFilePath);
- } else if (const auto **CM = std::any_cast<const Module *>(&IR)) {
- auto &M = *const_cast<Module *>(*CM);
+ } else if (any_isa<const Module *>(IR)) {
+ auto &M = *const_cast<Module *>(any_cast<const Module *>(IR));
if (Mode == DebugifyMode::SyntheticDebugInfo)
checkDebugifyMetadata(M, M.functions(), P, "CheckModuleDebugify",
/*Strip=*/true, DIStatsMap);