ABI/API checker: avoid printing fully qualified names in generic signature

The heuristics to decide whether fully qualified type names should be printed may
work differently when generating the baseline and when importing from just built
frameworks. This patch makes it consistent so that such false positives won't happen.

rdar://54276347
This commit is contained in:
Xi Ge
2019-08-13 15:13:34 -07:00
parent a79b1ff73d
commit dfcfdf726b
5 changed files with 12 additions and 8 deletions

View File

@@ -1090,6 +1090,10 @@ StringRef printGenericSignature(SDKContext &Ctx, ArrayRef<Requirement> AllReqs)
return StringRef();
OS << "<";
bool First = true;
PrintOptions Opts = PrintOptions::printInterface();
// We always print unqualifed type names to avoid false positives introduced
// by the heuristics working differently.
Opts.FullyQualifiedTypesIfAmbiguous = false;
for (auto Req: AllReqs) {
if (!First) {
OS << ", ";
@@ -1097,9 +1101,9 @@ StringRef printGenericSignature(SDKContext &Ctx, ArrayRef<Requirement> AllReqs)
First = false;
}
if (Ctx.checkingABI())
getCanonicalRequirement(Req).print(OS, PrintOptions::printInterface());
getCanonicalRequirement(Req).print(OS, Opts);
else
Req.print(OS, PrintOptions::printInterface());
Req.print(OS, Opts);
}
OS << ">";
return Ctx.buffer(OS.str());