[SourceKit] Stop using isSystemModule to represent "non-user" modules

Rather than using `ModuleDecl::isSystemModule()` to determine whether a
module is not a user module, instead check whether the module was
defined adjacent to the compiler or if it's part of the SDK.

If no SDK path was given, then `isSystemModule` is still used as a
fallback.

Resolves rdar://89253201.
This commit is contained in:
Ben Barham
2023-03-13 12:41:59 -07:00
parent b7a2fa28bf
commit eec2848508
20 changed files with 255 additions and 208 deletions

View File

@@ -611,15 +611,15 @@ public:
};
static const ValueDecl *getRelatedSystemDecl(const ValueDecl *VD) {
if (VD->getModuleContext()->isSystemModule())
if (VD->getModuleContext()->isNonUserModule())
return VD;
for (auto *Req : VD->getSatisfiedProtocolRequirements()) {
if (Req->getModuleContext()->isSystemModule())
if (Req->getModuleContext()->isNonUserModule())
return Req;
}
for (auto Over = VD->getOverriddenDecl(); Over;
Over = Over->getOverriddenDecl()) {
if (Over->getModuleContext()->isSystemModule())
if (Over->getModuleContext()->isNonUserModule())
return Over;
}
return nullptr;