[clang] [llvm] [polly] [IRBuilder] Make IRBuilder inserter non-virtual (PR #229700)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 7 05:35:20 PDT 2026


================
@@ -137,15 +136,15 @@ class IRBuilderBase {
 
 public:
   IRBuilderBase(LLVMContext &context, const IRBuilderFolder &Folder,
-                const IRBuilderDefaultInserter &Inserter)
-      : Context(context), Folder(Folder), Inserter(Inserter) {
+                InsertFn InsertCB)
+      : Context(context), Folder(Folder), InsertCB(InsertCB) {
     ClearInsertionPoint();
   }
 
   /// Insert and return the specified instruction.
   template<typename InstTy>
   InstTy *Insert(InstTy *I, const Twine &Name = "") const {
-    Inserter.InsertHelper(I, Name, InsertPt);
+    InsertCB(*this, I, Name, InsertPt);
----------------
nikic wrote:

Copying IRBuilderBase is just generally unsafe, because it's self-referential. So yes, we should delete the copy ctor.

(Copy assignment is implicitly deleted anyway.)

https://github.com/llvm/llvm-project/pull/229700


More information about the cfe-commits mailing list