Introduce non-recursive print options and use them to handle IUO

printing more elegantly.

NFC intended.
This commit is contained in:
John McCall
2025-06-18 11:47:36 +09:00
parent 09dc0920e7
commit 5c20b19296
10 changed files with 368 additions and 251 deletions

View File

@@ -1063,10 +1063,11 @@ static StringRef getPrintedName(SDKContext &Ctx, Type Ty,
llvm::raw_string_ostream OS(S);
PrintOptions PO = getTypePrintOpts(Ctx.getOpts());
PO.SkipAttributes = true;
NonRecursivePrintOptions OPO;
if (IsImplicitlyUnwrappedOptional)
PO.PrintOptionalAsImplicitlyUnwrapped = true;
OPO |= NonRecursivePrintOption::ImplicitlyUnwrappedOptional;
Ty.print(OS, PO);
Ty.print(OS, PO, OPO);
return Ctx.buffer(OS.str());
}