[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

@@ -252,10 +252,10 @@ static void reportSemanticAnnotations(const SourceTextInfo &IFaceInfo,
bool IsSystem;
if (Ref.Mod) {
Kind = SwiftLangSupport::getUIDForModuleRef();
IsSystem = Ref.Mod.isSystemModule();
IsSystem = Ref.Mod.isNonUserModule();
} else if (Ref.Dcl) {
Kind = SwiftLangSupport::getUIDForDecl(Ref.Dcl, /*IsRef=*/true);
IsSystem = Ref.Dcl->getModuleContext()->isSystemModule();
IsSystem = Ref.Dcl->getModuleContext()->isNonUserModule();
}
if (Kind.isInvalid())
continue;
@@ -505,7 +505,7 @@ bool SwiftInterfaceGenContext::matches(StringRef ModuleName,
if (Invok.getSDKPath() != Impl.Invocation.getSDKPath())
return false;
if (Impl.Mod->isSystemModule())
if (Impl.Mod->isNonUserModule())
return true;
const SearchPathOptions &SPOpts = Invok.getSearchPathOptions();