mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user