@@ -459,7 +459,7 @@ void SILType::dump() const {
459459static void printSILFunctionNameAndType (
460460 llvm::raw_ostream &OS, const SILFunction *function,
461461 llvm::DenseMap<CanType, Identifier> &sugaredTypeNames,
462- bool printFullConvention = false ) {
462+ const SILPrintContext *silPrintContext = nullptr ) {
463463 function->printName (OS);
464464 OS << " : $" ;
465465 auto *genEnv = function->getGenericEnvironment ();
@@ -496,7 +496,7 @@ static void printSILFunctionNameAndType(
496496 sugaredTypeNames[archetypeTy->getCanonicalType ()] = name;
497497 }
498498 }
499- auto printOptions = PrintOptions::printSIL (printFullConvention );
499+ auto printOptions = PrintOptions::printSIL (silPrintContext );
500500 printOptions.GenericSig = genSig;
501501 printOptions.AlternativeTypeNames =
502502 sugaredTypeNames.empty () ? nullptr : &sugaredTypeNames;
@@ -571,8 +571,7 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
571571 SILPrintContext &PrintCtx,
572572 llvm::DenseMap<CanType, Identifier> *AlternativeTypeNames = nullptr )
573573 : Ctx(PrintCtx), PrintState{{PrintCtx.OS ()},
574- PrintOptions::printSIL (
575- PrintCtx.printFullConvention ())},
574+ PrintOptions::printSIL (&PrintCtx)},
576575 LastBufferID (0 ) {
577576 PrintState.ASTOptions .AlternativeTypeNames = AlternativeTypeNames;
578577 PrintState.ASTOptions .PrintForSIL = true ;
@@ -2685,8 +2684,7 @@ void SILFunction::print(SILPrintContext &PrintCtx) const {
26852684 OS << " [ossa] " ;
26862685
26872686 llvm::DenseMap<CanType, Identifier> sugaredTypeNames;
2688- printSILFunctionNameAndType (OS, this , sugaredTypeNames,
2689- PrintCtx.printFullConvention ());
2687+ printSILFunctionNameAndType (OS, this , sugaredTypeNames, &PrintCtx);
26902688
26912689 if (!isExternalDeclaration ()) {
26922690 if (auto eCount = getEntryCount ()) {
@@ -2971,7 +2969,7 @@ static void printFileIDMap(SILPrintContext &Ctx, const FileIDMap map) {
29712969}
29722970
29732971void SILProperty::print (SILPrintContext &Ctx) const {
2974- PrintOptions Options = PrintOptions::printSIL (Ctx. printFullConvention () );
2972+ PrintOptions Options = PrintOptions::printSIL (& Ctx);
29752973
29762974 auto &OS = Ctx.OS ();
29772975 OS << " sil_property " ;
@@ -3612,3 +3610,20 @@ ID SILPrintContext::getID(const SILNode *node) {
36123610 ID R = {ID::SSAValue, ValueToIDMap[node]};
36133611 return R;
36143612}
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