Skip to content

Commit 48a091a

Browse files
committed
A random collection of little fixes needed to get this branch
building.
1 parent a5e784c commit 48a091a

File tree

13 files changed

+43
-33
lines changed

13 files changed

+43
-33
lines changed

lldb/include/lldb/Core/JITSection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class JITSection : public Section {
4242

4343
// LLVM RTTI support
4444
static char ID;
45-
virtual bool isA(const void *ClassID) const {
45+
bool isA(const void *ClassID) const override {
4646
return ClassID == &ID || Section::isA(ClassID);
4747
}
4848
static bool classof(const Section *obj) { return obj->isA(&ID); }

lldb/source/Core/Mangled.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ static ConstString GetDemangledNameWithoutArguments(ConstString mangled,
7777
if (SwiftLanguageRuntime::MethodName::ExtractFunctionBasenameFromMangled(
7878
mangled, basename, is_method)) {
7979
if (basename && basename != mangled) {
80-
g_most_recent_mangled_to_name_sans_args.first = mangled;
81-
g_most_recent_mangled_to_name_sans_args.second = basename;
82-
return (g_most_recent_mangled_to_name_sans_args.second);
80+
return basename;
8381
}
8482
}
8583
}

lldb/source/Core/ValueObject.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,13 @@ CompilerType ValueObject::MaybeCalculateCompleteType() {
313313

314314
// try the modules
315315
if (TargetSP target_sp = GetTargetSP()) {
316+
auto *persistent_state = llvm::cast<ClangPersistentVariables>(
317+
target_sp->GetPersistentExpressionStateForLanguage(lldb::eLanguageTypeC));
318+
if (!persistent_state)
319+
return compiler_type;
320+
316321
if (auto clang_modules_decl_vendor =
317-
target_sp->GetClangModulesDeclVendor()) {
322+
persistent_state->GetClangModulesDeclVendor()) {
318323
ConstString key_cs(class_name);
319324
auto types = clang_modules_decl_vendor->FindTypes(
320325
key_cs, /*max_matches*/ UINT32_MAX);

lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ bool SwiftLanguage::IsTopLevelFunction(Function &function) {
123123
return false;
124124
}
125125

126-
std::vector<ConstString>
126+
std::vector<Language::MethodNameVariant>
127127
SwiftLanguage::GetMethodNameVariants(ConstString method_name) const {
128-
std::vector<ConstString> variant_names;
128+
std::vector<Language::MethodNameVariant> variant_names;
129129

130130
// NOTE: We need to do this because we don't have a proper parser for Swift
131131
// function name syntax so we try to ensure that if we autocomplete to
@@ -135,7 +135,7 @@ SwiftLanguage::GetMethodNameVariants(ConstString method_name) const {
135135
ConstString counterpart;
136136
if (method_name.GetMangledCounterpart(counterpart))
137137
if (SwiftLanguageRuntime::IsSwiftMangledName(counterpart.GetStringRef()))
138-
variant_names.emplace_back(counterpart);
138+
variant_names.emplace_back(counterpart, eFunctionNameTypeFull);
139139
return variant_names;
140140
}
141141

lldb/source/Plugins/Language/Swift/SwiftLanguage.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ class SwiftLanguage : public Language {
3434

3535
bool IsTopLevelFunction(Function &function) override;
3636

37-
std::vector<ConstString>
37+
std::vector<Language::MethodNameVariant>
3838
GetMethodNameVariants(ConstString method_name) const override;
3939

40-
virtual lldb::TypeCategoryImplSP GetFormatters() override;
40+
lldb::TypeCategoryImplSP GetFormatters() override;
4141

4242
HardcodedFormatters::HardcodedSummaryFinder GetHardcodedSummaries() override;
4343

lldb/source/Plugins/Language/Swift/SwiftOptionSet.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ bool lldb_private::formatters::swift::SwiftOptionSetSummaryProvider::
205205
if (matched_value != value) {
206206
// Print the unaccounted-for bits separately.
207207
llvm::APInt residual = value & ~matched_value;
208-
ss << ", 0x" << residual.toString(16, false);
208+
llvm::SmallString<24> string;
209+
residual.toString(string, 16, false);
210+
ss << ", 0x" << string;
209211
}
210212
ss << ']';
211213

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ void SwiftLanguageRuntime::FindFunctionPointersInCall(
982982
CompilerType clang_void_ptr_type =
983983
clang_ctx->GetBasicType(eBasicTypeVoid).GetPointerType();
984984

985-
input_value.SetValueType(Value::eValueTypeScalar);
985+
input_value.SetValueType(Value::ValueType::Scalar);
986986
input_value.SetCompilerType(clang_void_ptr_type);
987987
argument_values.PushValue(input_value);
988988

@@ -1692,8 +1692,8 @@ llvm::Optional<Value> SwiftLanguageRuntime::GetErrorReturnLocationAfterReturn(
16921692

16931693
Value val;
16941694
if (reg_value.GetScalarValue(val.GetScalar())) {
1695-
val.SetValueType(Value::eValueTypeScalar);
1696-
val.SetContext(Value::eContextTypeRegisterInfo,
1695+
val.SetValueType(Value::ValueType::Scalar);
1696+
val.SetContext(Value::ContextType::RegisterInfo,
16971697
const_cast<RegisterInfo *>(reg_info));
16981698
error_val = val;
16991699
}

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,7 +1866,7 @@ bool SwiftLanguageRuntimeImpl::GetDynamicTypeAndAddress_Protocol(
18661866

18671867
if (in_value.GetValueType() == eValueTypeConstResult &&
18681868
in_value.GetValue().GetValueType() ==
1869-
lldb_private::Value::eValueTypeHostAddress) {
1869+
lldb_private::Value::ValueType::HostAddress) {
18701870
if (log)
18711871
log->Printf("existential value is a const result");
18721872

@@ -2431,7 +2431,7 @@ Value::ValueType SwiftLanguageRuntimeImpl::GetValueType(
24312431
return {};
24322432
if (swift_ast_ctx->IsErrorType(static_type.GetOpaqueQualType())) {
24332433
// ErrorType values are always a pointer
2434-
return Value::eValueTypeLoadAddress;
2434+
return Value::ValueType::LoadAddress;
24352435
}
24362436

24372437
if (auto *ts = llvm::dyn_cast_or_null<TypeSystemSwift>(
@@ -2446,7 +2446,7 @@ Value::ValueType SwiftLanguageRuntimeImpl::GetValueType(
24462446
return static_value_type;
24472447
case SwiftASTContext::TypeAllocationStrategy::ePointer: // pointed-to;
24482448
// in the target
2449-
return Value::eValueTypeLoadAddress;
2449+
return Value::ValueType::LoadAddress;
24502450
}
24512451
}
24522452
if (static_type_flags.AllSet(eTypeIsSwift | eTypeIsGenericTypeParam)) {
@@ -2458,14 +2458,14 @@ Value::ValueType SwiftLanguageRuntimeImpl::GetValueType(
24582458
// ObjC classes
24592459
if (dynamic_type_flags.AllClear(eTypeIsPointer | eTypeIsReference |
24602460
eTypeInstanceIsPointer))
2461-
return Value::eValueTypeLoadAddress;
2461+
return Value::ValueType::LoadAddress;
24622462
}
24632463

24642464
if (static_type_flags.AllSet(eTypeIsSwift | eTypeIsPointer) &&
24652465
static_type_flags.AllClear(eTypeIsGenericTypeParam)) {
24662466
// FIXME: This branch is not covered by any testcases in the test suite.
24672467
if (is_indirect_enum_case || static_type_flags.AllClear(eTypeIsBuiltIn))
2468-
return Value::eValueTypeLoadAddress;
2468+
return Value::ValueType::LoadAddress;
24692469
}
24702470
}
24712471

@@ -2476,7 +2476,7 @@ Value::ValueType SwiftLanguageRuntimeImpl::GetValueType(
24762476
dynamic_type_flags.AllClear(eTypeIsPointer | eTypeInstanceIsPointer))
24772477
return static_value_type;
24782478
else
2479-
return Value::eValueTypeScalar;
2479+
return Value::ValueType::Scalar;
24802480
}
24812481

24822482
bool SwiftLanguageRuntimeImpl::GetDynamicTypeAndAddress_ClangType(

lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6945,6 +6945,7 @@ llvm::StringRef ObjectFileMachO::GetReflectionSectionIdentifier(
69456945
#else
69466946
llvm_unreachable("Swift support disabled");
69476947
#endif //LLDB_ENABLE_SWIFT
6948+
}
69486949

69496950
ObjectFileMachO::MachOCorefileAllImageInfos
69506951
ObjectFileMachO::GetCorefileAllImageInfos() {

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserSwift.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ static llvm::StringRef GetTypedefName(const DWARFDIE &die) {
5151
DWARFDIE type_die = die.GetAttributeValueAsReferenceDIE(DW_AT_type);
5252
if (!type_die.IsValid())
5353
return {};
54-
return llvm::StringRef::withNullAsEmpty(type_die.GetName());
54+
if (!type_die.GetName())
55+
return {};
56+
return llvm::StringRef(type_die.GetName());
5557
}
5658

5759
lldb::TypeSP DWARFASTParserSwift::ParseTypeFromDWARF(const SymbolContext &sc,

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,11 +1534,11 @@ void SwiftASTContext::ApplyWorkingDir(
15341534
void SwiftASTContext::RemapClangImporterOptions(
15351535
const PathMappingList &path_map) {
15361536
auto &options = GetClangImporterOptions();
1537-
std::string remapped;
1538-
if (path_map.RemapPath(options.BridgingHeader, remapped)) {
1537+
ConstString remapped;
1538+
if (path_map.RemapPath(ConstString(options.BridgingHeader), remapped)) {
15391539
LOG_PRINTF(LIBLLDB_LOG_TYPES, "remapped %s -> %s",
1540-
options.BridgingHeader.c_str(), remapped.c_str());
1541-
options.BridgingHeader = remapped;
1540+
options.BridgingHeader.c_str(), remapped.GetCString());
1541+
options.BridgingHeader = remapped.GetCString();
15421542
}
15431543

15441544
// Previous argument was the dash-option of an option pair.
@@ -1561,10 +1561,10 @@ void SwiftASTContext::RemapClangImporterOptions(
15611561
continue;
15621562
}
15631563

1564-
if (path_map.RemapPath(arg, remapped)) {
1564+
if (path_map.RemapPath(ConstString(arg), remapped)) {
15651565
LOG_PRINTF(LIBLLDB_LOG_TYPES, "remapped %s -> %s%s", arg.str().c_str(),
1566-
prefix.str().c_str(), remapped.c_str());
1567-
arg_string = prefix.str() + remapped;
1566+
prefix.str().c_str(), remapped.GetCString());
1567+
arg_string = prefix.str() + remapped.GetCString();
15681568
}
15691569
}
15701570
}
@@ -3386,7 +3386,7 @@ swift::ASTContext *SwiftASTContext::GetASTContext() {
33863386
llvm::Optional<llvm::VersionTuple> sdk_version =
33873387
m_ast_context_ap->LangOpts.SDKVersion;
33883388
if (!sdk_version) {
3389-
auto SDKInfoOrErr = clang::driver::parseDarwinSDKInfo(
3389+
auto SDKInfoOrErr = clang::parseDarwinSDKInfo(
33903390
*llvm::vfs::getRealFileSystem(),
33913391
m_ast_context_ap->SearchPathOpts.SDKPath);
33923392
if (SDKInfoOrErr) {
@@ -7566,7 +7566,9 @@ CompilerType SwiftASTContext::GetUnboundGenericType(opaque_compiler_type_t type,
75667566
auto *nominal_type_decl = unbound_generic_type->getDecl();
75677567
swift::GenericSignature generic_sig =
75687568
nominal_type_decl->getGenericSignature();
7569-
auto depTy = generic_sig->getGenericParams()[idx];
7569+
swift::TypeArrayView<swift::GenericTypeParamType> depView
7570+
= generic_sig.getGenericParams();
7571+
swift::Type depTy = depView[idx];
75707572
return ToCompilerType({nominal_type_decl->mapTypeIntoContext(depTy)
75717573
->castTo<swift::ArchetypeType>()});
75727574
}

lldb/source/Symbol/Symtab.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,9 @@ void Symtab::InitNameIndexes() {
339339
is_method)) {
340340
if (basename && basename != mangled_name) {
341341
if (is_method)
342-
m_method_to_index.Append(basename, value);
342+
method_to_index.Append(basename, value);
343343
else
344-
m_basename_to_index.Append(basename, value);
344+
basename_to_index.Append(basename, value);
345345
}
346346
}
347347
}

lldb/source/Target/ThreadPlanStepInRange.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ bool ThreadPlanStepInRange::StepInDeepBreakpointExplainsStop(
351351
for (size_t i = 0; i < num_owners; i++) {
352352
BreakpointLocationSP owner_loc_sp(bp_site_sp->GetOwnerAtIndex(i));
353353
Breakpoint &owner_bp(owner_loc_sp->GetBreakpoint());
354-
if (owner_loc_sp->ValidForThisThread(&GetThread()) &&
354+
if (owner_loc_sp->ValidForThisThread(GetThread()) &&
355355
!owner_bp.IsInternal()) {
356356
explains_stop = false;
357357
break;

0 commit comments

Comments
 (0)