Skip to content

Commit 1e5aa72

Browse files
committed
Add in clang-format changes that I forgot to commit with the previous commit (sorry).
I clang-formatted the previous commit, but forgot to amend the changes.
1 parent 302632c commit 1e5aa72

File tree

13 files changed

+83
-100
lines changed

13 files changed

+83
-100
lines changed

include/swift/SIL/SILModule.h

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -449,20 +449,16 @@ class SILModule {
449449
/// This signature is a direct copy of the signature of SILFunction::create()
450450
/// in order to simplify refactoring all SILFunction creation use-sites to use
451451
/// SILModule. Eventually the uses should probably be refactored.
452-
SILFunction *getOrCreateFunction(SILLinkage linkage, StringRef name,
453-
CanSILFunctionType loweredType,
454-
GenericParamList *contextGenericParams,
455-
Optional<SILLocation> loc,
456-
IsBare_t isBareSILFunction,
457-
IsTransparent_t isTrans,
458-
IsFragile_t isFragile,
459-
IsThunk_t isThunk = IsNotThunk,
460-
SILFunction::ClassVisibility_t classVisibility = SILFunction::NotRelevant,
461-
Inline_t inlineStrategy = InlineDefault,
462-
EffectsKind EK = EffectsKind::Unspecified,
463-
SILFunction *InsertBefore = nullptr,
464-
const SILDebugScope *DebugScope = nullptr,
465-
DeclContext *DC = nullptr);
452+
SILFunction *getOrCreateFunction(
453+
SILLinkage linkage, StringRef name, CanSILFunctionType loweredType,
454+
GenericParamList *contextGenericParams, Optional<SILLocation> loc,
455+
IsBare_t isBareSILFunction, IsTransparent_t isTrans,
456+
IsFragile_t isFragile, IsThunk_t isThunk = IsNotThunk,
457+
SILFunction::ClassVisibility_t classVisibility = SILFunction::NotRelevant,
458+
Inline_t inlineStrategy = InlineDefault,
459+
EffectsKind EK = EffectsKind::Unspecified,
460+
SILFunction *InsertBefore = nullptr,
461+
const SILDebugScope *DebugScope = nullptr, DeclContext *DC = nullptr);
466462

467463
/// Look up the SILWitnessTable representing the lowering of a protocol
468464
/// conformance, and collect the substitutions to apply to the referenced

lib/Parse/ParseSIL.cpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,9 @@ SILFunction *SILParser::getGlobalNameForDefinition(Identifier Name,
372372
Fn->getLoweredFunctionType(), Ty);
373373
P.diagnose(It->second.second, diag::sil_prior_reference);
374374
auto loc = SILFileLocation(Loc);
375-
Fn = SILMod.getOrCreateFunction(SILLinkage::Private, "", Ty,
376-
nullptr, loc, IsNotBare, IsNotTransparent, IsNotFragile);
375+
Fn =
376+
SILMod.getOrCreateFunction(SILLinkage::Private, "", Ty, nullptr, loc,
377+
IsNotBare, IsNotTransparent, IsNotFragile);
377378
Fn->setDebugScope(new (SILMod) SILDebugScope(loc, *Fn));
378379
}
379380

@@ -392,17 +393,17 @@ SILFunction *SILParser::getGlobalNameForDefinition(Identifier Name,
392393
// defined already.
393394
if (SILMod.lookUpFunction(Name.str()) != nullptr) {
394395
P.diagnose(Loc, diag::sil_value_redefinition, Name.str());
395-
auto *fn = SILMod.getOrCreateFunction(SILLinkage::Private, "", Ty,
396-
nullptr, loc, IsNotBare, IsNotTransparent,
397-
IsNotFragile);
396+
auto *fn =
397+
SILMod.getOrCreateFunction(SILLinkage::Private, "", Ty, nullptr, loc,
398+
IsNotBare, IsNotTransparent, IsNotFragile);
398399
fn->setDebugScope(new (SILMod) SILDebugScope(loc, *fn));
399400
return fn;
400401
}
401402

402403
// Otherwise, this definition is the first use of this name.
403-
auto *fn = SILMod.getOrCreateFunction(SILLinkage::Private, Name.str(),
404-
Ty, nullptr, loc, IsNotBare, IsNotTransparent,
405-
IsNotFragile);
404+
auto *fn = SILMod.getOrCreateFunction(SILLinkage::Private, Name.str(), Ty,
405+
nullptr, loc, IsNotBare,
406+
IsNotTransparent, IsNotFragile);
406407
fn->setDebugScope(new (SILMod) SILDebugScope(loc, *fn));
407408
return fn;
408409
}
@@ -422,19 +423,19 @@ SILFunction *SILParser::getGlobalNameForReference(Identifier Name,
422423
if (FnRef->getLoweredFunctionType() != Ty) {
423424
P.diagnose(Loc, diag::sil_value_use_type_mismatch,
424425
Name.str(), FnRef->getLoweredFunctionType(), Ty);
425-
FnRef = SILMod.getOrCreateFunction(SILLinkage::Private, "", Ty, nullptr,
426-
loc, IsNotBare, IsNotTransparent,
427-
IsNotFragile);
426+
FnRef =
427+
SILMod.getOrCreateFunction(SILLinkage::Private, "", Ty, nullptr, loc,
428+
IsNotBare, IsNotTransparent, IsNotFragile);
428429
FnRef->setDebugScope(new (SILMod) SILDebugScope(loc, *FnRef));
429430
}
430431
return FnRef;
431432
}
432433

433434
// If we didn't find a function, create a new one - it must be a forward
434435
// reference.
435-
auto *Fn = SILMod.getOrCreateFunction(SILLinkage::Private,
436-
Name.str(), Ty, nullptr, loc, IsNotBare,
437-
IsNotTransparent, IsNotFragile);
436+
auto *Fn = SILMod.getOrCreateFunction(SILLinkage::Private, Name.str(), Ty,
437+
nullptr, loc, IsNotBare,
438+
IsNotTransparent, IsNotFragile);
438439
Fn->setDebugScope(new (SILMod) SILDebugScope(loc, *Fn));
439440
TUState.ForwardRefFns[Name] = { Fn, Loc };
440441
TUState.Diags = &P.Diags;

lib/SIL/SILModule.cpp

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -398,22 +398,17 @@ SILFunction *SILModule::getOrCreateSharedFunction(SILLocation loc,
398398
isThunk, SILFunction::NotRelevant);
399399
}
400400

401-
SILFunction *SILModule::getOrCreateFunction(SILLinkage linkage, StringRef name,
402-
CanSILFunctionType loweredType,
403-
GenericParamList *contextGenericParams,
404-
Optional<SILLocation> loc,
405-
IsBare_t isBareSILFunction,
406-
IsTransparent_t isTrans,
407-
IsFragile_t isFragile,
408-
IsThunk_t isThunk,
409-
SILFunction::ClassVisibility_t classVisibility,
410-
Inline_t inlineStrategy,
411-
EffectsKind EK,
412-
SILFunction *InsertBefore,
413-
const SILDebugScope *DebugScope,
414-
DeclContext *DC) {
401+
SILFunction *SILModule::getOrCreateFunction(
402+
SILLinkage linkage, StringRef name, CanSILFunctionType loweredType,
403+
GenericParamList *contextGenericParams, Optional<SILLocation> loc,
404+
IsBare_t isBareSILFunction, IsTransparent_t isTrans, IsFragile_t isFragile,
405+
IsThunk_t isThunk, SILFunction::ClassVisibility_t classVisibility,
406+
Inline_t inlineStrategy, EffectsKind EK, SILFunction *InsertBefore,
407+
const SILDebugScope *DebugScope, DeclContext *DC) {
415408
return SILFunction::create(*this, linkage, name, loweredType,
416-
contextGenericParams, loc, isBareSILFunction, isTrans, isFragile, isThunk, classVisibility, inlineStrategy, EK, InsertBefore, DebugScope, DC);
409+
contextGenericParams, loc, isBareSILFunction,
410+
isTrans, isFragile, isThunk, classVisibility,
411+
inlineStrategy, EK, InsertBefore, DebugScope, DC);
417412
}
418413

419414
ArrayRef<SILType> ValueBase::getTypes() const {

lib/SILGen/SILGen.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,10 @@ SILFunction *SILGenModule::emitTopLevelFunction(SILLocation Loc) {
210210
None,
211211
C);
212212

213-
return M.getOrCreateFunction(SILLinkage::Public,
214-
SWIFT_ENTRY_POINT_FUNCTION, topLevelType, nullptr,
215-
Loc, IsBare, IsNotTransparent, IsNotFragile,
216-
IsNotThunk, SILFunction::NotRelevant);
213+
return M.getOrCreateFunction(SILLinkage::Public, SWIFT_ENTRY_POINT_FUNCTION,
214+
topLevelType, nullptr, Loc, IsBare,
215+
IsNotTransparent, IsNotFragile, IsNotThunk,
216+
SILFunction::NotRelevant);
217217
}
218218

219219
SILType SILGenModule::getConstantType(SILDeclRef constant) {
@@ -723,10 +723,9 @@ SILFunction *SILGenModule::emitLazyGlobalInitializer(StringRef funcName,
723723
auto initSILType = getLoweredType(initType).castTo<SILFunctionType>();
724724

725725
auto *f =
726-
M.getOrCreateFunction(SILLinkage::Private, funcName,
727-
initSILType, nullptr, SILLocation(binding),
728-
IsNotBare, IsNotTransparent,
729-
makeModuleFragile ? IsFragile : IsNotFragile);
726+
M.getOrCreateFunction(SILLinkage::Private, funcName, initSILType, nullptr,
727+
SILLocation(binding), IsNotBare, IsNotTransparent,
728+
makeModuleFragile ? IsFragile : IsNotFragile);
730729
f->setDebugScope(new (M)
731730
SILDebugScope(RegularLocation(binding->getInit(pbdEntry)),
732731
*f));

lib/SILGen/SILGenDecl.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,16 +1765,11 @@ SILGenModule::emitProtocolWitness(ProtocolConformance *conformance,
17651765
if (witness.isAlwaysInline())
17661766
InlineStrategy = AlwaysInline;
17671767

1768-
auto *f = M.getOrCreateFunction(linkage, nameBuffer,
1769-
witnessSILType.castTo<SILFunctionType>(),
1770-
witnessContextParams,
1771-
SILLocation(witness.getDecl()),
1772-
IsNotBare,
1773-
IsTransparent,
1774-
makeModuleFragile ? IsFragile : IsNotFragile,
1775-
IsThunk,
1776-
SILFunction::NotRelevant,
1777-
InlineStrategy);
1768+
auto *f = M.getOrCreateFunction(
1769+
linkage, nameBuffer, witnessSILType.castTo<SILFunctionType>(),
1770+
witnessContextParams, SILLocation(witness.getDecl()), IsNotBare,
1771+
IsTransparent, makeModuleFragile ? IsFragile : IsNotFragile, IsThunk,
1772+
SILFunction::NotRelevant, InlineStrategy);
17781773

17791774
f->setDebugScope(new (M)
17801775
SILDebugScope(RegularLocation(witness.getDecl()), *f));

lib/SILGen/SILGenType.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ SILGenModule::emitVTableMethod(SILDeclRef derived, SILDeclRef base) {
8888

8989
auto *derivedDecl = cast<AbstractFunctionDecl>(derived.getDecl());
9090
SILLocation loc(derivedDecl);
91-
auto thunk = M.getOrCreateFunction(SILLinkage::Private, name,
92-
overrideInfo.SILFnType,
93-
derivedDecl->getGenericParams(),
94-
loc, IsBare, IsNotTransparent, IsNotFragile);
91+
auto thunk =
92+
M.getOrCreateFunction(SILLinkage::Private, name, overrideInfo.SILFnType,
93+
derivedDecl->getGenericParams(), loc, IsBare,
94+
IsNotTransparent, IsNotFragile);
9595
thunk->setDebugScope(new (M) SILDebugScope(loc, *thunk));
9696

9797
SILGenFunction(*this, *thunk)

lib/SILPasses/IPO/CapturePromotion.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -452,13 +452,11 @@ ClosureCloner::initCloned(SILFunction *Orig, StringRef ClonedName,
452452
&& "SILFunction missing DebugScope");
453453
assert(!Orig->isGlobalInit() && "Global initializer cannot be cloned");
454454

455-
auto *Fn =
456-
M.getOrCreateFunction(Orig->getLinkage(), ClonedName, SubstTy,
457-
Orig->getContextGenericParams(), Orig->getLocation(),
458-
Orig->isBare(), IsNotTransparent, Orig->isFragile(),
459-
Orig->isThunk(),
460-
Orig->getClassVisibility(), Orig->getInlineStrategy(),
461-
Orig->getEffectsKind(), Orig, Orig->getDebugScope());
455+
auto *Fn = M.getOrCreateFunction(
456+
Orig->getLinkage(), ClonedName, SubstTy, Orig->getContextGenericParams(),
457+
Orig->getLocation(), Orig->isBare(), IsNotTransparent, Orig->isFragile(),
458+
Orig->isThunk(), Orig->getClassVisibility(), Orig->getInlineStrategy(),
459+
Orig->getEffectsKind(), Orig, Orig->getDebugScope());
462460
Fn->setSemanticsAttr(Orig->getSemanticsAttr());
463461
Fn->setDeclCtx(Orig->getDeclContext());
464462
return Fn;

lib/SILPasses/IPO/CapturePropagation.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,12 @@ SILFunction *CapturePropagation::specializeConstClosure(PartialApplyInst *PAI,
233233
CanSILFunctionType NewFTy =
234234
Lowering::adjustFunctionType(PAI->getType().castTo<SILFunctionType>(),
235235
SILFunctionType::Representation::Thin);
236-
SILFunction *NewF = getModule()->getOrCreateFunction(SILLinkage::Shared, Name, NewFTy,
236+
SILFunction *NewF = getModule()->getOrCreateFunction(
237+
SILLinkage::Shared, Name, NewFTy,
237238
/*contextGenericParams*/ nullptr, OrigF->getLocation(), OrigF->isBare(),
238239
OrigF->isTransparent(), OrigF->isFragile(), OrigF->isThunk(),
239-
OrigF->getClassVisibility(),
240-
OrigF->getInlineStrategy(), OrigF->getEffectsKind(),
240+
OrigF->getClassVisibility(), OrigF->getInlineStrategy(),
241+
OrigF->getEffectsKind(),
241242
/*InsertBefore*/ OrigF, OrigF->getDebugScope(), OrigF->getDeclContext());
242243
NewF->setDeclCtx(OrigF->getDeclContext());
243244
DEBUG(llvm::dbgs() << " Specialize callee as ";

lib/SILPasses/IPO/ClosureSpecializer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,8 @@ ClosureSpecCloner::initCloned(const CallSiteDescriptor &CallSiteDesc,
546546

547547
// We make this function bare so we don't have to worry about decls in the
548548
// SILArgument.
549-
auto *Fn = M.getOrCreateFunction(ClosureUser->getLinkage(), ClonedName, ClonedTy,
549+
auto *Fn = M.getOrCreateFunction(
550+
ClosureUser->getLinkage(), ClonedName, ClonedTy,
550551
ClosureUser->getContextGenericParams(), ClosureUser->getLocation(),
551552
IsBare, ClosureUser->isTransparent(), ClosureUser->isFragile(),
552553
ClosureUser->isThunk(), ClosureUser->getClassVisibility(),

lib/SILPasses/IPO/FunctionSignatureOpts.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,10 +604,11 @@ SILFunction *FunctionAnalyzer::createEmptyFunctionWithOptimizedSig(
604604
CanSILFunctionType NewFTy = createOptimizedSILFunctionType();
605605

606606
// Create the new function.
607-
auto *NewF = M.getOrCreateFunction(F->getLinkage(), NewFName, NewFTy, nullptr, F->getLocation(),
608-
F->isBare(), F->isTransparent(), F->isFragile(), F->isThunk(),
609-
F->getClassVisibility(), F->getInlineStrategy(), F->getEffectsKind(), 0,
610-
F->getDebugScope(), F->getDeclContext());
607+
auto *NewF = M.getOrCreateFunction(
608+
F->getLinkage(), NewFName, NewFTy, nullptr, F->getLocation(), F->isBare(),
609+
F->isTransparent(), F->isFragile(), F->isThunk(), F->getClassVisibility(),
610+
F->getInlineStrategy(), F->getEffectsKind(), 0, F->getDebugScope(),
611+
F->getDeclContext());
611612

612613
NewF->setDeclCtx(F->getDeclContext());
613614

0 commit comments

Comments
 (0)