Skip to content

[llvm] use new noncopyable infrastructure #8384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,9 +1065,6 @@ static const char *getImportFailureString(swift::serialization::Status status) {
case swift::serialization::Status::NotInOSSA:
return "The module file was not compiled with -enable-ossa-modules when it "
"was required to do so.";
case swift::serialization::Status::NoncopyableGenericsMismatch:
return "The module file was compiled with a mismatching "
"-enable-experimental-feature NoncopyableGenerics setting.";
case swift::serialization::Status::SDKMismatch:
return "The module file was built with a different SDK version.";
}
Expand Down Expand Up @@ -1262,7 +1259,6 @@ static bool DeserializeAllCompilerFlags(swift::CompilerInvocation &invocation,
auto &langOpts = invocation.getLangOptions();
info = swift::serialization::validateSerializedAST(
buf, invocation.getSILOptions().EnableOSSAModules,
langOpts.hasFeature(swift::Feature::NoncopyableGenerics),
/*requiredSDK*/ StringRef(), &extended_validation_info,
/*dependencies*/ nullptr, &searchPaths);
bool invalid_ast = info.status != swift::serialization::Status::Valid;
Expand Down Expand Up @@ -3445,8 +3441,7 @@ swift::ASTContext *SwiftASTContext::GetASTContext() {
std::make_unique<swift::ModuleInterfaceCheckerImpl>(*m_ast_context_ap,
moduleCachePath, prebuiltModuleCachePath,
swift::ModuleInterfaceLoaderOptions(),
swift::RequireOSSAModules_t(GetSILOptions()),
swift::RequireNoncopyableGenerics_t(GetLanguageOptions())));
swift::RequireOSSAModules_t(GetSILOptions())));

// 2. Create and install the module interface loader.
//
Expand Down Expand Up @@ -5611,7 +5606,6 @@ bool SwiftASTContext::GetProtocolTypeInfo(const CompilerType &type,

swift::ExistentialLayout layout = swift_can_type.getExistentialLayout();
protocol_info.m_is_class_only = layout.requiresClass();
protocol_info.m_num_protocols = layout.getProtocols().size();
protocol_info.m_is_objc = layout.isObjC();
protocol_info.m_is_anyobject = layout.isAnyObject();
protocol_info.m_is_errortype = layout.isErrorExistential();
Expand All @@ -5621,11 +5615,24 @@ bool SwiftASTContext::GetProtocolTypeInfo(const CompilerType &type,
}

unsigned num_witness_tables = 0;
unsigned num_protocols = 0;
for (auto protoDecl : layout.getProtocols()) {
// Ignore invertible protocols like Copyable entirely. They're marker
// protocols that are not mangled into generic signatures. Only their
// absence is mangled.
// FIXME: this should probably be filtering all marker protocols,
// including Sendable, since marker protocols lack a witness table.
if (protoDecl->getInvertibleProtocolKind())
continue;

num_protocols++;

if (!protoDecl->isObjC())
num_witness_tables++;
}

protocol_info.m_num_protocols = num_protocols;

if (layout.isErrorExistential()) {
// Error existential -- instance pointer only.
protocol_info.m_num_payload_words = 0;
Expand Down