Skip to content

Commit 1b3ed00

Browse files
Merge pull request #9332 from adrian-prantl/remove-classic-invocations
Remove classic whole-project compiler invocations.
2 parents ea827d1 + ad57a42 commit 1b3ed00

31 files changed

+355
-824
lines changed

lldb/include/lldb/Core/ModuleList.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,10 @@ class ModuleListProperties : public Properties {
8080
bool GetUseSwiftClangImporter() const;
8181
bool GetUseSwiftDWARFImporter() const;
8282
bool SetUseSwiftDWARFImporter(bool new_value);
83-
bool GetUseSwiftTypeRefTypeSystem() const;
84-
bool SetUseSwiftTypeRefTypeSystem(bool new_value);
8583
bool GetSwiftValidateTypeSystem() const;
8684
SwiftModuleLoadingMode GetSwiftModuleLoadingMode() const;
8785
bool SetSwiftModuleLoadingMode(SwiftModuleLoadingMode);
8886

89-
bool GetUseSwiftPreciseCompilerInvocation() const;
9087
bool GetEnableSwiftMetadataCache() const;
9188
uint64_t GetSwiftMetadataCacheMaxByteSize();
9289
uint64_t GetSwiftMetadataCacheExpirationDays();

lldb/include/lldb/Target/Target.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,8 @@ class Target : public std::enable_shared_from_this<Target>,
13011301

13021302
std::optional<SwiftScratchContextReader>
13031303
GetSwiftScratchContext(Status &error, ExecutionContextScope &exe_scope,
1304-
bool create_on_demand = true);
1304+
bool create_on_demand = true,
1305+
bool for_playground = false);
13051306

13061307
/// Return whether this is the Swift REPL.
13071308
bool IsSwiftREPL();

lldb/source/Core/CoreProperties.td

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,9 @@ let Definition = "modulelist" in {
2525
def UseSwiftDWARFImporter: Property<"use-swift-dwarfimporter", "Boolean">,
2626
DefaultTrue,
2727
Desc<"Reconstruct Clang module dependencies from DWARF when debugging Swift code">;
28-
def UseSwiftTypeRefTypeSystem: Property<"use-swift-typeref-typesystem", "Boolean">,
29-
DefaultTrue,
30-
Desc<"Prefer Swift Remote Mirrors over Remote AST">;
3128
def SwiftValidateTypeSystem: Property<"swift-validate-typesystem", "Boolean">,
3229
DefaultFalse,
3330
Desc<"Validate all Swift typesystem queries. Used for testing an asserts-enabled LLDB only.">;
34-
def UseSwiftPreciseCompilerInvocation: Property<"swift-precise-compiler-invocation", "Boolean">,
35-
DefaultTrue,
36-
Desc<"In the Swift expression evaluator, create many Swift compiler instances with the precise invocation for the current context, instead of a single compiler instance that merges all flags from the entire project.">;
3731
def SwiftModuleLoadingMode: Property<"swift-module-loading-mode", "Enum">,
3832
DefaultEnumValue<"eSwiftModuleLoadingModePreferSerialized">,
3933
EnumValues<"OptionEnumValues(g_swift_module_loading_mode_enums)">,

lldb/source/Core/Module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,7 @@ bool Module::SetArchitecture(const ArchSpec &new_arch) {
16341634
#ifdef LLDB_ENABLE_SWIFT
16351635
if (auto ts =
16361636
llvm::dyn_cast_or_null<TypeSystemSwift>(type_system_or_err->get()))
1637-
ts->SetTriple(new_arch.GetTriple());
1637+
ts->SetTriple(SymbolContext(shared_from_this()), new_arch.GetTriple());
16381638
#endif // LLDB_ENABLE_SWIFT
16391639
return true;
16401640
}

lldb/source/Core/ModuleList.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -194,29 +194,12 @@ bool ModuleListProperties::SetUseSwiftDWARFImporter(bool new_value) {
194194
return SetPropertyAtIndex(idx, new_value);
195195
}
196196

197-
bool ModuleListProperties::GetUseSwiftTypeRefTypeSystem() const {
198-
const uint32_t idx = ePropertyUseSwiftTypeRefTypeSystem;
199-
return GetPropertyAtIndexAs<bool>(
200-
idx, g_modulelist_properties[idx].default_uint_value != 0);
201-
}
202-
203197
bool ModuleListProperties::GetSwiftValidateTypeSystem() const {
204198
const uint32_t idx = ePropertySwiftValidateTypeSystem;
205199
return GetPropertyAtIndexAs<bool>(
206200
idx, g_modulelist_properties[idx].default_uint_value != 0);
207201
}
208202

209-
bool ModuleListProperties::GetUseSwiftPreciseCompilerInvocation() const {
210-
const uint32_t idx = ePropertyUseSwiftPreciseCompilerInvocation;
211-
return GetPropertyAtIndexAs<bool>(
212-
idx, g_modulelist_properties[idx].default_uint_value != 0);
213-
}
214-
215-
bool ModuleListProperties::SetUseSwiftTypeRefTypeSystem(bool new_value) {
216-
const uint32_t idx = ePropertyUseSwiftTypeRefTypeSystem;
217-
return SetPropertyAtIndex(idx, new_value);
218-
}
219-
220203
SwiftModuleLoadingMode ModuleListProperties::GetSwiftModuleLoadingMode() const {
221204
const uint32_t idx = ePropertySwiftModuleLoadingMode;
222205
return GetPropertyAtIndexAs<SwiftModuleLoadingMode>(

lldb/source/Expression/IRExecutionUnit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ IRExecutionUnit::FindInSymbols(const std::vector<ConstString> &names,
845845
// BEGIN SWIFT
846846
if (m_in_populate_symtab)
847847
if (lldb::ModuleSP module_sp = m_jit_module_wp.lock())
848-
images.Remove(module_sp);
848+
images.Remove(module_sp);
849849
// END SWIFT
850850

851851
SymbolContextList sc_list;

lldb/source/Plugins/ExpressionParser/Swift/SwiftASTManipulator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ llvm::Expected<swift::Type> SwiftASTManipulator::GetSwiftTypeForVariable(
897897
// When injecting a value pack or pack count into the outer
898898
// lldb_expr function, treat it as an opaque raw pointer.
899899
if (m_bind_generic_types == lldb::eDontBind && variable.IsUnboundPack()) {
900-
auto swift_ast_ctx = type_system_swift->GetSwiftASTContext(&m_sc);
900+
auto swift_ast_ctx = type_system_swift->GetSwiftASTContext(m_sc);
901901
if (!swift_ast_ctx)
902902
return llvm::createStringError("no typesystem for variable " +
903903
variable.GetName().str());

lldb/source/Plugins/ExpressionParser/Swift/SwiftREPL.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,8 @@ void SwiftREPL::CompleteCode(const std::string &current_code,
569569
type_system_or_err->get());
570570
auto *target_swift_ast =
571571
llvm::dyn_cast_or_null<SwiftASTContextForExpressions>(
572-
swift_ts->GetSwiftASTContext(nullptr));
572+
swift_ts->GetSwiftASTContext(SymbolContext(
573+
m_target.shared_from_this(), m_target.GetExecutableModule())));
573574
m_swift_ast = target_swift_ast;
574575
}
575576
SwiftASTContextForExpressions *swift_ast = m_swift_ast;

lldb/source/Plugins/ExpressionParser/Swift/SwiftUserExpression.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -721,25 +721,28 @@ bool SwiftUserExpression::Parse(DiagnosticManager &diagnostic_manager,
721721
return error("couldn't start parsing - no stack frame");
722722

723723
ExecutionContextScope *exe_scope =
724-
m_options.GetREPLEnabled() ? static_cast<ExecutionContextScope *>(target)
725-
: static_cast<ExecutionContextScope *>(frame);
724+
m_options.GetREPLEnabled() || m_options.GetPlaygroundTransformEnabled()
725+
? static_cast<ExecutionContextScope *>(target)
726+
: static_cast<ExecutionContextScope *>(frame);
726727

727-
exe_scope = exe_ctx.GetBestExecutionContextScope();
728+
exe_scope = exe_ctx.GetBestExecutionContextScope();
728729

729-
m_swift_scratch_ctx = target->GetSwiftScratchContext(m_err, *exe_scope);
730+
m_swift_scratch_ctx = target->GetSwiftScratchContext(
731+
m_err, *exe_scope, /*create_on_demand=*/true,
732+
m_options.GetPlaygroundTransformEnabled());
730733
if (!m_swift_scratch_ctx)
731734
return error("could not create a Swift scratch context: ",
732735
m_err.AsCString());
733736

734737
// For playgrounds, the target triple should be used for expression
735738
// evaluation, not the current module. This requires disabling precise
736739
// compiler invocations.
737-
//
738-
// To disable precise compiler invocations, pass a null SymbolContext.
739-
const SymbolContext *sc = nullptr;
740-
if (!m_runs_in_playground_or_repl)
741-
sc = &frame->GetSymbolContext(lldb::eSymbolContextFunction);
742-
740+
SymbolContext sc;
741+
if (m_options.GetREPLEnabled() || m_options.GetPlaygroundTransformEnabled())
742+
sc = SymbolContext(target->shared_from_this(),
743+
target->GetExecutableModule());
744+
else
745+
sc = frame->GetSymbolContext(lldb::eSymbolContextFunction);
743746
auto *swift_ast_ctx = m_swift_scratch_ctx->get()->GetSwiftASTContext(sc);
744747
m_swift_ast_ctx =
745748
llvm::dyn_cast_or_null<SwiftASTContextForExpressions>(swift_ast_ctx);

lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ static std::string TranslateObjCNameToSwiftName(std::string className,
103103
const SymbolContext *sc = nullptr;
104104
if (swiftFrame)
105105
sc = &swiftFrame->GetSymbolContext(eSymbolContextFunction);
106-
auto *ctx = ts->GetSwiftASTContext(sc);
106+
if (!sc)
107+
return "";
108+
auto *ctx = ts->GetSwiftASTContext(*sc);
107109
if (!ctx)
108110
return "";
109111
swift::ClangImporter *imp = ctx->GetClangImporter();

0 commit comments

Comments
 (0)