[Serialization] Shorten extension USRs.

We actually do not need to pre-append the USR of the extended nominal;
a short mangling-incompatible prefix will sufficiently do the trick.

Suggested by @jrose-apple.
This commit is contained in:
Xi Ge
2016-03-15 17:07:55 -07:00
parent 892181158f
commit 2751bb96b6

View File

@@ -118,12 +118,11 @@ bool ide::printExtensionUSR(const ExtensionDecl *ED, raw_ostream &OS) {
if (ED->getExtendedType().isNull())
return true;
// We make up a unique usr for each extension by combining the usr of the
// extended type and the first value member of the extension.
if (printDeclUSR(ED->getExtendedType()->getAnyNominal(), OS))
return true;
// We make up a unique usr for each extension by combining a prefix
// and the USR of the first value member of the extension.
for (auto D : ED->getMembers()) {
if (auto VD = dyn_cast<ValueDecl>(D)) {
OS << "ext:";
return printDeclUSR(VD, OS);
}
}