ldc/ldc-1.32.2-llvm-16-fix-ms_cxx_helper.patch

32 lines
1.0 KiB
Diff

From 4d5b7dc86e5a282914b46c4982f612228bb75bb0 Mon Sep 17 00:00:00 2001
From: Ikey Doherty <ikey@serpentos.com>
Date: Mon, 22 May 2023 08:48:56 +0100
Subject: [PATCH] gen/ms-cxx-helper: Use new `insertInto` LLVM16 API
Instructions now use friend APIs to add themselves into a
BasicBlock, rather than a BasicBlock having an API to add
the instructions.
Signed-off-by: Ikey Doherty <ikey@serpentos.com>
---
gen/ms-cxx-helper.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gen/ms-cxx-helper.cpp b/gen/ms-cxx-helper.cpp
index 52814fd5cf..9f4eb7627f 100644
--- a/gen/ms-cxx-helper.cpp
+++ b/gen/ms-cxx-helper.cpp
@@ -114,7 +114,12 @@ void cloneBlocks(const std::vector<llvm::BasicBlock *> &srcblocks,
if (!newInst)
newInst = Inst->clone();
+ #if LDC_LLVM_VER < 1600
nbb->getInstList().push_back(newInst);
+ #else
+ newInst->insertInto(nbb, nbb->end());
+ #endif
+
VMap[Inst] = newInst; // Add instruction map to value.
if (unwindTo)
if (auto dest = getUnwindDest(Inst))