File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1460,6 +1460,25 @@ void PrintAST::printWhereClause(ArrayRef<RequirementRepr> requirements) {
1460
1460
if (requirements.empty ())
1461
1461
return ;
1462
1462
1463
+ // FIXME: Type objects do not preserve info to print requirements accurately.
1464
+ // SIL printing cares about semantics so \c PrevPreferTypeRepr is false but
1465
+ // we need to set it to true for printing requirements.
1466
+ struct PrefTypeReprForSILRAII {
1467
+ PrintOptions &Opts;
1468
+ bool PrevPreferTypeRepr;
1469
+ PrefTypeReprForSILRAII (PrintOptions &opts) : Opts(opts) {
1470
+ if (Opts.PrintForSIL ) {
1471
+ PrevPreferTypeRepr = Opts.PreferTypeRepr ;
1472
+ Opts.PreferTypeRepr = true ;
1473
+ }
1474
+ }
1475
+ ~PrefTypeReprForSILRAII () {
1476
+ if (Opts.PrintForSIL ) {
1477
+ Opts.PreferTypeRepr = PrevPreferTypeRepr;
1478
+ }
1479
+ }
1480
+ } PrefTypeReprForSILRAII (Options);
1481
+
1463
1482
std::vector<std::tuple<StringRef, StringRef, RequirementReprKind>> Elements;
1464
1483
llvm::SmallString<64 > Output;
1465
1484
bool Handled = true ;
You can’t perform that action at this time.
0 commit comments