swift-module-digester: refactor the ABI/API diagnostics to use DiagnosticEngine. NFC (#18957)

Before this patch, we used to define tooling-specific diagnostics. With adding more
checking logics, we found this mechanism hard to extend. This patch
eliminates the home-made diagnostics model to use the one from compiler, which provides
several benefits: less boiler-templates, better integration with DiagnosticConsumer,
and easy ordering of detected issues.
This commit is contained in:
Xi Ge
2018-08-24 13:11:32 -07:00
committed by GitHub
parent 574b7f45be
commit e4388af6be
15 changed files with 349 additions and 290 deletions

View File

@@ -293,6 +293,22 @@ SDKNode *SDKNodeRoot::getInstance(SDKContext &Ctx) {
return Info.createSDKNode(SDKNodeKind::Root);
}
StringRef SDKNodeDecl::getScreenInfo() const {
auto ModuleName = getModuleName();
auto HeaderName = getHeaderName();
auto &Ctx = getSDKContext();
llvm::SmallString<64> SS;
llvm::raw_svector_ostream OS(SS);
if (Ctx.getOpts().PrintModule)
OS << ModuleName;
if (!HeaderName.empty())
OS << "(" << HeaderName << ")";
if (!OS.str().empty())
OS << ": ";
OS << getDeclKind() << " " << getFullyQualifiedName();
return Ctx.buffer(OS.str());
}
bool SDKNodeDecl::isSDKPrivate() const {
if (getName().startswith("__"))
return true;