Skip to content

Commit 2751bb9

Browse files
committed
[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.
1 parent 8921811 commit 2751bb9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/AST/USRGeneration.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,11 @@ bool ide::printExtensionUSR(const ExtensionDecl *ED, raw_ostream &OS) {
118118
if (ED->getExtendedType().isNull())
119119
return true;
120120

121-
// We make up a unique usr for each extension by combining the usr of the
122-
// extended type and the first value member of the extension.
123-
if (printDeclUSR(ED->getExtendedType()->getAnyNominal(), OS))
124-
return true;
121+
// We make up a unique usr for each extension by combining a prefix
122+
// and the USR of the first value member of the extension.
125123
for (auto D : ED->getMembers()) {
126124
if (auto VD = dyn_cast<ValueDecl>(D)) {
125+
OS << "ext:";
127126
return printDeclUSR(VD, OS);
128127
}
129128
}

0 commit comments

Comments
 (0)