@@ -459,7 +459,7 @@ void SILType::dump() const {
459
459
static void printSILFunctionNameAndType (
460
460
llvm::raw_ostream &OS, const SILFunction *function,
461
461
llvm::DenseMap<CanType, Identifier> &sugaredTypeNames,
462
- bool printFullConvention = false ) {
462
+ const SILPrintContext *silPrintContext = nullptr ) {
463
463
function->printName (OS);
464
464
OS << " : $" ;
465
465
auto *genEnv = function->getGenericEnvironment ();
@@ -496,7 +496,7 @@ static void printSILFunctionNameAndType(
496
496
sugaredTypeNames[archetypeTy->getCanonicalType ()] = name;
497
497
}
498
498
}
499
- auto printOptions = PrintOptions::printSIL (printFullConvention );
499
+ auto printOptions = PrintOptions::printSIL (silPrintContext );
500
500
printOptions.GenericSig = genSig;
501
501
printOptions.AlternativeTypeNames =
502
502
sugaredTypeNames.empty () ? nullptr : &sugaredTypeNames;
@@ -571,8 +571,7 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
571
571
SILPrintContext &PrintCtx,
572
572
llvm::DenseMap<CanType, Identifier> *AlternativeTypeNames = nullptr )
573
573
: Ctx(PrintCtx), PrintState{{PrintCtx.OS ()},
574
- PrintOptions::printSIL (
575
- PrintCtx.printFullConvention ())},
574
+ PrintOptions::printSIL (&PrintCtx)},
576
575
LastBufferID (0 ) {
577
576
PrintState.ASTOptions .AlternativeTypeNames = AlternativeTypeNames;
578
577
PrintState.ASTOptions .PrintForSIL = true ;
@@ -2685,8 +2684,7 @@ void SILFunction::print(SILPrintContext &PrintCtx) const {
2685
2684
OS << " [ossa] " ;
2686
2685
2687
2686
llvm::DenseMap<CanType, Identifier> sugaredTypeNames;
2688
- printSILFunctionNameAndType (OS, this , sugaredTypeNames,
2689
- PrintCtx.printFullConvention ());
2687
+ printSILFunctionNameAndType (OS, this , sugaredTypeNames, &PrintCtx);
2690
2688
2691
2689
if (!isExternalDeclaration ()) {
2692
2690
if (auto eCount = getEntryCount ()) {
@@ -2971,7 +2969,7 @@ static void printFileIDMap(SILPrintContext &Ctx, const FileIDMap map) {
2971
2969
}
2972
2970
2973
2971
void SILProperty::print (SILPrintContext &Ctx) const {
2974
- PrintOptions Options = PrintOptions::printSIL (Ctx. printFullConvention () );
2972
+ PrintOptions Options = PrintOptions::printSIL (& Ctx);
2975
2973
2976
2974
auto &OS = Ctx.OS ();
2977
2975
OS << " sil_property " ;
@@ -3612,3 +3610,20 @@ ID SILPrintContext::getID(const SILNode *node) {
3612
3610
ID R = {ID::SSAValue, ValueToIDMap[node]};
3613
3611
return R;
3614
3612
}
3613
+
3614
+ PrintOptions PrintOptions::printSIL (const SILPrintContext *ctx) {
3615
+ PrintOptions result;
3616
+ result.PrintLongAttrsOnSeparateLines = true ;
3617
+ result.PrintStorageRepresentationAttrs = true ;
3618
+ result.AbstractAccessors = false ;
3619
+ result.PrintForSIL = true ;
3620
+ result.PrintInSILBody = true ;
3621
+ result.PreferTypeRepr = false ;
3622
+ result.PrintIfConfig = false ;
3623
+ result.OpaqueReturnTypePrinting =
3624
+ OpaqueReturnTypePrintingMode::StableReference;
3625
+ if (ctx && ctx->printFullConvention ())
3626
+ result.PrintFunctionRepresentationAttrs =
3627
+ PrintOptions::FunctionRepresentationMode::Full;
3628
+ return result;
3629
+ }
0 commit comments