Skip to content

Commit 64ad05b

Browse files
committed
[gardening] Standardize variable capitalization in SILGenBuilder to match the rest of SILGen. NFC.
1 parent 78a514c commit 64ad05b

File tree

2 files changed

+164
-160
lines changed

2 files changed

+164
-160
lines changed

lib/SILGen/SILGenBuilder.cpp

Lines changed: 124 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -71,50 +71,49 @@ MetatypeInst *SILGenBuilder::createMetatype(SILLocation loc, SILType metatype) {
7171
return SILBuilder::createMetatype(loc, metatype);
7272
}
7373

74-
ApplyInst *SILGenBuilder::createApply(SILLocation Loc, SILValue Fn,
75-
SILType SubstFnTy, SILType Result,
76-
SubstitutionList Subs,
77-
ArrayRef<SILValue> Args) {
78-
getSILGenModule().useConformancesFromSubstitutions(Subs);
79-
return SILBuilder::createApply(Loc, Fn, SubstFnTy, Result, Subs, Args, false);
80-
}
81-
82-
TryApplyInst *SILGenBuilder::createTryApply(SILLocation loc, SILValue Fn,
83-
SILType substFnTy,
84-
SubstitutionList subs,
85-
ArrayRef<SILValue> args,
86-
SILBasicBlock *normalBB,
87-
SILBasicBlock *errorBB) {
74+
ApplyInst *SILGenBuilder::createApply(SILLocation loc, SILValue fn,
75+
SILType substFnTy, SILType result,
76+
SubstitutionList subs,
77+
ArrayRef<SILValue> args) {
8878
getSILGenModule().useConformancesFromSubstitutions(subs);
89-
return SILBuilder::createTryApply(loc, Fn, substFnTy, subs, args, normalBB,
79+
return SILBuilder::createApply(loc, fn, substFnTy, result, subs, args, false);
80+
}
81+
82+
TryApplyInst *
83+
SILGenBuilder::createTryApply(SILLocation loc, SILValue fn, SILType substFnTy,
84+
SubstitutionList subs, ArrayRef<SILValue> args,
85+
SILBasicBlock *normalBB, SILBasicBlock *errorBB) {
86+
getSILGenModule().useConformancesFromSubstitutions(subs);
87+
return SILBuilder::createTryApply(loc, fn, substFnTy, subs, args, normalBB,
9088
errorBB);
9189
}
9290

93-
PartialApplyInst *SILGenBuilder::createPartialApply(
94-
SILLocation Loc, SILValue Fn, SILType SubstFnTy,
95-
SubstitutionList Subs, ArrayRef<SILValue> Args, SILType ClosureTy) {
96-
getSILGenModule().useConformancesFromSubstitutions(Subs);
97-
return SILBuilder::createPartialApply(Loc, Fn, SubstFnTy, Subs, Args,
98-
ClosureTy);
91+
PartialApplyInst *
92+
SILGenBuilder::createPartialApply(SILLocation loc, SILValue fn,
93+
SILType substFnTy, SubstitutionList subs,
94+
ArrayRef<SILValue> args, SILType closureTy) {
95+
getSILGenModule().useConformancesFromSubstitutions(subs);
96+
return SILBuilder::createPartialApply(loc, fn, substFnTy, subs, args,
97+
closureTy);
9998
}
10099

101-
BuiltinInst *SILGenBuilder::createBuiltin(SILLocation Loc, Identifier Name,
102-
SILType ResultTy,
103-
SubstitutionList Subs,
104-
ArrayRef<SILValue> Args) {
105-
getSILGenModule().useConformancesFromSubstitutions(Subs);
106-
return SILBuilder::createBuiltin(Loc, Name, ResultTy, Subs, Args);
100+
BuiltinInst *SILGenBuilder::createBuiltin(SILLocation loc, Identifier name,
101+
SILType resultTy,
102+
SubstitutionList subs,
103+
ArrayRef<SILValue> args) {
104+
getSILGenModule().useConformancesFromSubstitutions(subs);
105+
return SILBuilder::createBuiltin(loc, name, resultTy, subs, args);
107106
}
108107

109108
InitExistentialAddrInst *SILGenBuilder::createInitExistentialAddr(
110-
SILLocation Loc, SILValue Existential, CanType FormalConcreteType,
111-
SILType LoweredConcreteType,
112-
ArrayRef<ProtocolConformanceRef> Conformances) {
113-
for (auto conformance : Conformances)
109+
SILLocation loc, SILValue existential, CanType formalConcreteType,
110+
SILType loweredConcreteType,
111+
ArrayRef<ProtocolConformanceRef> conformances) {
112+
for (auto conformance : conformances)
114113
getSILGenModule().useConformance(conformance);
115114

116115
return SILBuilder::createInitExistentialAddr(
117-
Loc, Existential, FormalConcreteType, LoweredConcreteType, Conformances);
116+
loc, existential, formalConcreteType, loweredConcreteType, conformances);
118117
}
119118

120119
InitExistentialMetatypeInst *SILGenBuilder::createInitExistentialMetatype(
@@ -128,111 +127,115 @@ InitExistentialMetatypeInst *SILGenBuilder::createInitExistentialMetatype(
128127
}
129128

130129
InitExistentialRefInst *SILGenBuilder::createInitExistentialRef(
131-
SILLocation Loc, SILType ExistentialType, CanType FormalConcreteType,
132-
SILValue Concrete, ArrayRef<ProtocolConformanceRef> Conformances) {
133-
for (auto conformance : Conformances)
130+
SILLocation loc, SILType existentialType, CanType formalConcreteType,
131+
SILValue concreteValue, ArrayRef<ProtocolConformanceRef> conformances) {
132+
for (auto conformance : conformances)
134133
getSILGenModule().useConformance(conformance);
135134

136135
return SILBuilder::createInitExistentialRef(
137-
Loc, ExistentialType, FormalConcreteType, Concrete, Conformances);
136+
loc, existentialType, formalConcreteType, concreteValue, conformances);
138137
}
139138

140139
AllocExistentialBoxInst *SILGenBuilder::createAllocExistentialBox(
141-
SILLocation Loc, SILType ExistentialType, CanType ConcreteType,
142-
ArrayRef<ProtocolConformanceRef> Conformances) {
143-
for (auto conformance : Conformances)
140+
SILLocation loc, SILType existentialType, CanType concreteType,
141+
ArrayRef<ProtocolConformanceRef> conformances) {
142+
for (auto conformance : conformances)
144143
getSILGenModule().useConformance(conformance);
145144

146-
return SILBuilder::createAllocExistentialBox(Loc, ExistentialType,
147-
ConcreteType, Conformances);
145+
return SILBuilder::createAllocExistentialBox(loc, existentialType,
146+
concreteType, conformances);
148147
}
149148

150-
ManagedValue SILGenBuilder::createStructExtract(SILLocation Loc,
151-
ManagedValue Base,
152-
VarDecl *Decl) {
153-
ManagedValue BorrowedBase = gen.emitManagedBeginBorrow(Loc, Base.getValue());
154-
SILValue StructExtract =
155-
SILBuilder::createStructExtract(Loc, BorrowedBase.getValue(), Decl);
156-
return ManagedValue::forUnmanaged(StructExtract);
149+
ManagedValue SILGenBuilder::createStructExtract(SILLocation loc,
150+
ManagedValue base,
151+
VarDecl *decl) {
152+
ManagedValue borrowedBase = gen.emitManagedBeginBorrow(loc, base.getValue());
153+
SILValue extract =
154+
SILBuilder::createStructExtract(loc, borrowedBase.getValue(), decl);
155+
return ManagedValue::forUnmanaged(extract);
157156
}
158157

159-
ManagedValue SILGenBuilder::createCopyValue(SILLocation Loc,
160-
ManagedValue OriginalValue) {
161-
SILValue Result = SILBuilder::createCopyValue(Loc, OriginalValue.getValue());
162-
return gen.emitManagedRValueWithCleanup(Result);
158+
ManagedValue SILGenBuilder::createCopyValue(SILLocation loc,
159+
ManagedValue originalValue) {
160+
SILValue result = SILBuilder::createCopyValue(loc, originalValue.getValue());
161+
return gen.emitManagedRValueWithCleanup(result);
163162
}
164163

165-
ManagedValue SILGenBuilder::createCopyUnownedValue(SILLocation Loc,
166-
ManagedValue OriginalValue) {
167-
auto UnownedType = OriginalValue.getType().castTo<UnownedStorageType>();
168-
assert(UnownedType->isLoadable(ResilienceExpansion::Maximal));
169-
(void)UnownedType;
164+
ManagedValue SILGenBuilder::createCopyUnownedValue(SILLocation loc,
165+
ManagedValue originalValue) {
166+
auto unownedType = originalValue.getType().castTo<UnownedStorageType>();
167+
assert(unownedType->isLoadable(ResilienceExpansion::Maximal));
168+
(void)unownedType;
170169

171-
SILValue Result =
172-
SILBuilder::createCopyUnownedValue(Loc, OriginalValue.getValue());
173-
return gen.emitManagedRValueWithCleanup(Result);
170+
SILValue result =
171+
SILBuilder::createCopyUnownedValue(loc, originalValue.getValue());
172+
return gen.emitManagedRValueWithCleanup(result);
174173
}
175174

176175
ManagedValue
177-
SILGenBuilder::createUnsafeCopyUnownedValue(SILLocation Loc,
178-
ManagedValue OriginalValue) {
179-
auto UnmanagedType = OriginalValue.getType().getAs<UnmanagedStorageType>();
180-
SILValue Result = SILBuilder::createUnmanagedToRef(
181-
Loc, OriginalValue.getValue(),
182-
SILType::getPrimitiveObjectType(UnmanagedType.getReferentType()));
183-
SILBuilder::createUnmanagedRetainValue(Loc, Result);
184-
return gen.emitManagedRValueWithCleanup(Result);
185-
}
186-
187-
ManagedValue SILGenBuilder::createOwnedPHIArgument(SILType Type) {
188-
SILPHIArgument *Arg =
189-
getInsertionBB()->createPHIArgument(Type, ValueOwnershipKind::Owned);
190-
return gen.emitManagedRValueWithCleanup(Arg);
191-
}
192-
193-
ManagedValue SILGenBuilder::createAllocRef(SILLocation Loc, SILType RefType, bool objc, bool canAllocOnStack,
194-
ArrayRef<SILType> InputElementTypes,
195-
ArrayRef<ManagedValue> InputElementCountOperands) {
196-
llvm::SmallVector<SILType, 8> ElementTypes(InputElementTypes.begin(),
197-
InputElementTypes.end());
198-
llvm::SmallVector<SILValue, 8> ElementCountOperands;
199-
std::transform(std::begin(InputElementCountOperands),
200-
std::end(InputElementCountOperands),
201-
std::back_inserter(ElementCountOperands),
202-
[](ManagedValue M) -> SILValue { return M.getValue(); });
203-
204-
AllocRefInst *ARI =
205-
SILBuilder::createAllocRef(Loc, RefType, objc, canAllocOnStack,
206-
ElementTypes, ElementCountOperands);
207-
return gen.emitManagedRValueWithCleanup(ARI);
208-
}
209-
210-
ManagedValue SILGenBuilder::createAllocRefDynamic(SILLocation Loc, ManagedValue Operand, SILType RefType, bool objc,
211-
ArrayRef<SILType> InputElementTypes,
212-
ArrayRef<ManagedValue> InputElementCountOperands) {
213-
llvm::SmallVector<SILType, 8> ElementTypes(InputElementTypes.begin(),
214-
InputElementTypes.end());
215-
llvm::SmallVector<SILValue, 8> ElementCountOperands;
216-
std::transform(std::begin(InputElementCountOperands),
217-
std::end(InputElementCountOperands),
218-
std::back_inserter(ElementCountOperands),
219-
[](ManagedValue M) -> SILValue { return M.getValue(); });
220-
221-
AllocRefDynamicInst *ARDI =
222-
SILBuilder::createAllocRefDynamic(Loc, Operand.getValue(), RefType, objc,
223-
ElementTypes, ElementCountOperands);
224-
return gen.emitManagedRValueWithCleanup(ARDI);
225-
}
226-
227-
ManagedValue SILGenBuilder::createTupleExtract(SILLocation Loc, ManagedValue Base, unsigned Index,
228-
SILType Type) {
229-
ManagedValue BorrowedBase = gen.emitManagedBeginBorrow(Loc, Base.getValue());
230-
SILValue TupleExtract =
231-
SILBuilder::createTupleExtract(Loc, BorrowedBase.getValue(), Index, Type);
232-
return ManagedValue::forUnmanaged(TupleExtract);
233-
}
234-
235-
ManagedValue SILGenBuilder::createTupleExtract(SILLocation Loc, ManagedValue Value, unsigned Index) {
236-
SILType Type = Value.getType().getTupleElementType(Index);
237-
return createTupleExtract(Loc, Value, Index, Type);
176+
SILGenBuilder::createUnsafeCopyUnownedValue(SILLocation loc,
177+
ManagedValue originalValue) {
178+
auto unmanagedType = originalValue.getType().getAs<UnmanagedStorageType>();
179+
SILValue result = SILBuilder::createUnmanagedToRef(
180+
loc, originalValue.getValue(),
181+
SILType::getPrimitiveObjectType(unmanagedType.getReferentType()));
182+
SILBuilder::createUnmanagedRetainValue(loc, result);
183+
return gen.emitManagedRValueWithCleanup(result);
184+
}
185+
186+
ManagedValue SILGenBuilder::createOwnedPHIArgument(SILType type) {
187+
SILPHIArgument *arg =
188+
getInsertionBB()->createPHIArgument(type, ValueOwnershipKind::Owned);
189+
return gen.emitManagedRValueWithCleanup(arg);
190+
}
191+
192+
ManagedValue SILGenBuilder::createAllocRef(
193+
SILLocation loc, SILType refType, bool objc, bool canAllocOnStack,
194+
ArrayRef<SILType> inputElementTypes,
195+
ArrayRef<ManagedValue> inputElementCountOperands) {
196+
llvm::SmallVector<SILType, 8> elementTypes(inputElementTypes.begin(),
197+
inputElementTypes.end());
198+
llvm::SmallVector<SILValue, 8> elementCountOperands;
199+
std::transform(std::begin(inputElementCountOperands),
200+
std::end(inputElementCountOperands),
201+
std::back_inserter(elementCountOperands),
202+
[](ManagedValue mv) -> SILValue { return mv.getValue(); });
203+
204+
AllocRefInst *i = SILBuilder::createAllocRef(
205+
loc, refType, objc, canAllocOnStack, elementTypes, elementCountOperands);
206+
return gen.emitManagedRValueWithCleanup(i);
207+
}
208+
209+
ManagedValue SILGenBuilder::createAllocRefDynamic(
210+
SILLocation loc, ManagedValue operand, SILType refType, bool objc,
211+
ArrayRef<SILType> inputElementTypes,
212+
ArrayRef<ManagedValue> inputElementCountOperands) {
213+
llvm::SmallVector<SILType, 8> elementTypes(inputElementTypes.begin(),
214+
inputElementTypes.end());
215+
llvm::SmallVector<SILValue, 8> elementCountOperands;
216+
std::transform(std::begin(inputElementCountOperands),
217+
std::end(inputElementCountOperands),
218+
std::back_inserter(elementCountOperands),
219+
[](ManagedValue mv) -> SILValue { return mv.getValue(); });
220+
221+
AllocRefDynamicInst *i =
222+
SILBuilder::createAllocRefDynamic(loc, operand.getValue(), refType, objc,
223+
elementTypes, elementCountOperands);
224+
return gen.emitManagedRValueWithCleanup(i);
225+
}
226+
227+
ManagedValue SILGenBuilder::createTupleExtract(SILLocation loc,
228+
ManagedValue base,
229+
unsigned index, SILType type) {
230+
ManagedValue borrowedBase = gen.emitManagedBeginBorrow(loc, base.getValue());
231+
SILValue extract =
232+
SILBuilder::createTupleExtract(loc, borrowedBase.getValue(), index, type);
233+
return ManagedValue::forUnmanaged(extract);
234+
}
235+
236+
ManagedValue SILGenBuilder::createTupleExtract(SILLocation loc,
237+
ManagedValue value,
238+
unsigned index) {
239+
SILType type = value.getType().getTupleElementType(index);
240+
return createTupleExtract(loc, value, index, type);
238241
}

0 commit comments

Comments
 (0)