Skip to content

[lldb] Add experimental setting for Swift explicit modules #8291

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
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions lldb/include/lldb/Target/Target.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ class TargetProperties : public Properties {

bool GetSwiftEnableFullDwarfDebugging() const;

bool GetSwiftAllowExplicitModules() const;

Args GetSwiftPluginServerForPath() const;

bool GetSwiftAutoImportFrameworks() const;
Expand Down
7 changes: 4 additions & 3 deletions lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1578,9 +1578,10 @@ void SwiftASTContext::AddExtraClangArgs(const std::vector<std::string> &source,
// module loading.
// TODO: Incorporate loading explicit module dependencies to
// speedup dependency resolution.
if (has_explicit_builds_enabled &&
match_explicit_build_option(clang_argument))
continue;
if (!Target::GetGlobalProperties().GetSwiftAllowExplicitModules())
if (has_explicit_builds_enabled &&
match_explicit_build_option(clang_argument))
continue;

// Otherwise add the argument to the list.
if (!IsMacroDefinition(clang_argument))
Expand Down
13 changes: 13 additions & 0 deletions lldb/source/Target/Target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4987,6 +4987,19 @@ bool TargetProperties::GetSwiftEnableFullDwarfDebugging() const {
return false;
}

bool TargetProperties::GetSwiftAllowExplicitModules() const {
const Property *exp_property =
m_collection_sp->GetPropertyAtIndex(ePropertyExperimental);
OptionValueProperties *exp_values =
exp_property->GetValue()->GetAsProperties();
if (exp_values)
return exp_values
->GetPropertyAtIndexAs<bool>(ePropertySwiftAllowExplicitModules)
.value_or(false);

return false;
}

Args TargetProperties::GetSwiftPluginServerForPath() const {
const uint32_t idx = ePropertySwiftPluginServerForPath;

Expand Down
7 changes: 5 additions & 2 deletions lldb/source/Target/TargetProperties.td
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ let Definition = "target_experimental" in {
ElementType<"String">,
Desc<"A dictionary of plugin paths as keys and swift-plugin-server binaries as values">;
def SwiftEnableFullDwarfDebugging: Property<"swift-enable-full-dwarf-debugging", "Boolean">,
DefaultFalse,
Desc<"Read full debug information from DWARF for Swift debugging, whenever possible">;
DefaultFalse,
Desc<"Read full debug information from DWARF for Swift debugging, whenever possible">;
def SwiftAllowExplicitModules: Property<"swift-allow-explicit-modules", "Boolean">,
DefaultFalse,
Desc<"Allows explicit module flags to be passed through to ClangImporter.">;
}

let Definition = "target" in {
Expand Down