swift-api-digester: describing external type declarations as extensions in error messages

External type declarations are synthesized to incorporate members in extensions to types
of external modules. In diagnostics, we should use 'extension' instead of 'struct/class'
for these decls to avoid confusion.
This commit is contained in:
Xi Ge
2019-05-28 14:08:33 -07:00
parent 967f1e64b4
commit 05bec0c3e3
4 changed files with 15 additions and 1 deletions

View File

@@ -385,7 +385,15 @@ StringRef SDKNodeDecl::getScreenInfo() const {
OS << "(" << HeaderName << ")";
if (!OS.str().empty())
OS << ": ";
OS << getDeclKind() << " " << getFullyQualifiedName();
bool IsExtension = false;
if (auto *TD = dyn_cast<SDKNodeDeclType>(this)) {
IsExtension = TD->isExternal();
}
if (IsExtension)
OS << "Extension";
else
OS << getDeclKind();
OS << " " << getFullyQualifiedName();
return Ctx.buffer(OS.str());
}