Skip to content

Commit 22782c4

Browse files
authored
[lldb] Add experimental setting for Swift explicit modules (swiftlang#8291)
1 parent 0defaba commit 22782c4

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

lldb/include/lldb/Target/Target.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ class TargetProperties : public Properties {
188188

189189
bool GetSwiftEnableFullDwarfDebugging() const;
190190

191+
bool GetSwiftAllowExplicitModules() const;
192+
191193
Args GetSwiftPluginServerForPath() const;
192194

193195
bool GetSwiftAutoImportFrameworks() const;

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,9 +1578,10 @@ void SwiftASTContext::AddExtraClangArgs(const std::vector<std::string> &source,
15781578
// module loading.
15791579
// TODO: Incorporate loading explicit module dependencies to
15801580
// speedup dependency resolution.
1581-
if (has_explicit_builds_enabled &&
1582-
match_explicit_build_option(clang_argument))
1583-
continue;
1581+
if (!Target::GetGlobalProperties().GetSwiftAllowExplicitModules())
1582+
if (has_explicit_builds_enabled &&
1583+
match_explicit_build_option(clang_argument))
1584+
continue;
15841585

15851586
// Otherwise add the argument to the list.
15861587
if (!IsMacroDefinition(clang_argument))

lldb/source/Target/Target.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4987,6 +4987,19 @@ bool TargetProperties::GetSwiftEnableFullDwarfDebugging() const {
49874987
return false;
49884988
}
49894989

4990+
bool TargetProperties::GetSwiftAllowExplicitModules() const {
4991+
const Property *exp_property =
4992+
m_collection_sp->GetPropertyAtIndex(ePropertyExperimental);
4993+
OptionValueProperties *exp_values =
4994+
exp_property->GetValue()->GetAsProperties();
4995+
if (exp_values)
4996+
return exp_values
4997+
->GetPropertyAtIndexAs<bool>(ePropertySwiftAllowExplicitModules)
4998+
.value_or(false);
4999+
5000+
return false;
5001+
}
5002+
49905003
Args TargetProperties::GetSwiftPluginServerForPath() const {
49915004
const uint32_t idx = ePropertySwiftPluginServerForPath;
49925005

lldb/source/Target/TargetProperties.td

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ let Definition = "target_experimental" in {
2828
ElementType<"String">,
2929
Desc<"A dictionary of plugin paths as keys and swift-plugin-server binaries as values">;
3030
def SwiftEnableFullDwarfDebugging: Property<"swift-enable-full-dwarf-debugging", "Boolean">,
31-
DefaultFalse,
32-
Desc<"Read full debug information from DWARF for Swift debugging, whenever possible">;
31+
DefaultFalse,
32+
Desc<"Read full debug information from DWARF for Swift debugging, whenever possible">;
33+
def SwiftAllowExplicitModules: Property<"swift-allow-explicit-modules", "Boolean">,
34+
DefaultFalse,
35+
Desc<"Allows explicit module flags to be passed through to ClangImporter.">;
3336
}
3437

3538
let Definition = "target" in {

0 commit comments

Comments
 (0)