Skip to content

Commit f085261

Browse files
committed
[IRBuilder] Add additional overload with in-place Inserter construction (NFC)
Currently, for IRBuilders that require an explicitly constructed Folder, we also force Inserter to be constructed and then copied. Provide a variant where the Inserter uses in-place default construction, to support cases where it is self-referential.
1 parent 108e6bc commit f085261

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

llvm/include/llvm/IR/IRBuilder.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2708,12 +2708,17 @@ class IRBuilder : public IRBuilderBase {
27082708
InserterTy Inserter;
27092709

27102710
public:
2711-
IRBuilder(LLVMContext &C, FolderTy Folder, InserterTy Inserter = InserterTy(),
2711+
IRBuilder(LLVMContext &C, FolderTy Folder, InserterTy Inserter,
27122712
MDNode *FPMathTag = nullptr,
27132713
ArrayRef<OperandBundleDef> OpBundles = {})
27142714
: IRBuilderBase(C, this->Folder, this->Inserter, FPMathTag, OpBundles),
27152715
Folder(Folder), Inserter(Inserter) {}
27162716

2717+
IRBuilder(LLVMContext &C, FolderTy Folder, MDNode *FPMathTag = nullptr,
2718+
ArrayRef<OperandBundleDef> OpBundles = {})
2719+
: IRBuilderBase(C, this->Folder, this->Inserter, FPMathTag, OpBundles),
2720+
Folder(Folder) {}
2721+
27172722
explicit IRBuilder(LLVMContext &C, MDNode *FPMathTag = nullptr,
27182723
ArrayRef<OperandBundleDef> OpBundles = {})
27192724
: IRBuilderBase(C, this->Folder, this->Inserter, FPMathTag, OpBundles) {}

0 commit comments

Comments
 (0)