Skip to content

Commit 3daad27

Browse files
authored
Merge pull request #8888 from bnbarham/get-next-building
[lldb] Various changes to get building on `next`
2 parents e6ddc48 + 66f6fa9 commit 3daad27

20 files changed

+8484
-1290
lines changed

lldb/bindings/python/static-binding/LLDBWrapPython.cpp

Lines changed: 7238 additions & 1013 deletions
Large diffs are not rendered by default.

lldb/bindings/python/static-binding/lldb.py

Lines changed: 1155 additions & 205 deletions
Large diffs are not rendered by default.

lldb/source/Host/macosx/objcxx/HostInfoMacOSXSwift.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static XcodeSDK::Type GetSDKType(const llvm::Triple &target,
6969

7070
auto is_simulator = [&]() -> bool {
7171
return target.getEnvironment() == llvm::Triple::Simulator ||
72-
!target.getArchName().startswith("arm");
72+
!target.getArchName().starts_with("arm");
7373
};
7474

7575
switch (target.getOS()) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ void SwiftASTManipulator::FindSpecialNames(
210210
if (auto *UDRE = llvm::dyn_cast<swift::UnresolvedDeclRefExpr>(E)) {
211211
swift::Identifier name = UDRE->getName().getBaseIdentifier();
212212

213-
if (m_prefix.empty() || name.str().startswith(m_prefix))
213+
if (m_prefix.empty() || name.str().starts_with(m_prefix))
214214
m_names.push_back(name);
215215
}
216216

@@ -540,7 +540,7 @@ void SwiftASTManipulator::FindVariableDeclarations(
540540
if (m_repl) {
541541
for (swift::Decl *decl : m_source_file.getTopLevelDecls()) {
542542
if (swift::VarDecl *var_decl = llvm::dyn_cast<swift::VarDecl>(decl)) {
543-
if (!var_decl->getName().str().startswith("$")) {
543+
if (!var_decl->getName().str().starts_with("$")) {
544544
register_one_var(var_decl);
545545
}
546546
}
@@ -562,7 +562,7 @@ void SwiftASTManipulator::FindVariableDeclarations(
562562
{
563563
swift::Identifier name = var_decl->getName();
564564

565-
if (name.str().startswith("$")) {
565+
if (name.str().starts_with("$")) {
566566
var_decl->setDebuggerVar(true);
567567
register_one_var(var_decl);
568568
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ class SwiftASTManipulatorBase {
109109
swift::VarDecl *GetDecl() const { return m_decl; }
110110
swift::VarDecl::Introducer GetVarIntroducer() const;
111111
bool IsCaptureList() const;
112-
bool IsMetadataPointer() const { return m_name.str().startswith(""); }
112+
bool IsMetadataPointer() const { return m_name.str().starts_with(""); }
113113
bool IsOutermostMetadataPointer() const {
114-
return m_name.str().startswith("$τ_0_");
114+
return m_name.str().starts_with("$τ_0_");
115115
}
116116
bool IsSelf() const {
117117
return m_name.str().equals("$__lldb_injected_self");
118118
}
119119
bool IsPackCount() const {
120-
return m_name.str().startswith("$pack_count_");
120+
return m_name.str().starts_with("$pack_count_");
121121
}
122122
bool IsUnboundPack() const { return m_is_unbound_pack; }
123123

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ SwiftExpressionParser::ParseAndImport(
13491349
if (enable_bare_slash_regex_literals) {
13501350
lang_opts.enableFeature(swift::Feature::BareSlashRegexLiterals);
13511351
}
1352-
if (uint32_t version = m_expr.Language().version) {
1352+
if (uint32_t version = m_expr.Language().version)
13531353
lang_opts.EffectiveLanguageVersion =
13541354
llvm::VersionTuple(version / 100, version % 100);
13551355
if (lang_opts.EffectiveLanguageVersion >= swift::version::Version({6}))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ Status SwiftExpressionSourceCode::GetText(
597597
if (auto process_sp = exe_ctx.GetProcessSP()) {
598598
os_vers << getAvailabilityName(triple) << " ";
599599
auto platform = target->GetPlatform();
600-
bool is_simulator = platform->GetPluginName().endswith("-simulator");
600+
bool is_simulator = platform->GetPluginName().ends_with("-simulator");
601601
if (is_simulator) {
602602
// The simulators look like the host OS to Process, but Platform
603603
// can the version out of an environment variable.

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ SwiftArrayBufferHandler::CreateBufferHandler(ValueObject &static_valobj) {
297297

298298
// For now we have to keep the old mangled name since the Objc->Swift bindings
299299
// that are in Foundation don't get the new mangling.
300-
if (valobj_typename.startswith("_TtCs23_ContiguousArrayStorage") ||
301-
valobj_typename.startswith("Swift._ContiguousArrayStorage")) {
300+
if (valobj_typename.starts_with("_TtCs23_ContiguousArrayStorage") ||
301+
valobj_typename.starts_with("Swift._ContiguousArrayStorage")) {
302302
CompilerType anyobject_type = clang_ts_sp->GetBasicType(
303303
lldb::eBasicTypeObjCID);
304304
auto handler = std::unique_ptr<SwiftArrayBufferHandler>(
@@ -310,8 +310,8 @@ SwiftArrayBufferHandler::CreateBufferHandler(ValueObject &static_valobj) {
310310
return nullptr;
311311
}
312312

313-
if (valobj_typename.startswith("_TtCs22__SwiftDeferredNSArray") ||
314-
valobj_typename.startswith("Swift.__SwiftDeferredNSArray")) {
313+
if (valobj_typename.starts_with("_TtCs22__SwiftDeferredNSArray") ||
314+
valobj_typename.starts_with("Swift.__SwiftDeferredNSArray")) {
315315
ProcessSP process_sp(valobj.GetProcessSP());
316316
if (!process_sp)
317317
return nullptr;
@@ -357,7 +357,7 @@ SwiftArrayBufferHandler::CreateBufferHandler(ValueObject &static_valobj) {
357357

358358
ExecutionContext exe_ctx(valobj.GetExecutionContextRef());
359359
ExecutionContextScope *exe_scope = exe_ctx.GetBestExecutionContextScope();
360-
if (valobj_typename.startswith("Swift.ContiguousArray<")) {
360+
if (valobj_typename.starts_with("Swift.ContiguousArray<")) {
361361
// Swift.NativeArray
362362
static ConstString g__buffer("_buffer");
363363
static ConstString g__storage("_storage");
@@ -378,9 +378,9 @@ SwiftArrayBufferHandler::CreateBufferHandler(ValueObject &static_valobj) {
378378
if (handler && handler->IsValid())
379379
return handler;
380380
return nullptr;
381-
} else if (valobj_typename.startswith("Swift.ArraySlice<") ||
382-
(valobj_typename.startswith("Swift.Array<") &&
383-
valobj_typename.endswith(">.SubSequence"))) {
381+
} else if (valobj_typename.starts_with("Swift.ArraySlice<") ||
382+
(valobj_typename.starts_with("Swift.Array<") &&
383+
valobj_typename.ends_with(">.SubSequence"))) {
384384
// ArraySlice or Array<T>.SubSequence, which is a typealias to ArraySlice.
385385
static ConstString g_buffer("_buffer");
386386

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ static bool makeStringGutsSummary(
205205
llvm::StringRef variantCase = variant_sp->GetValueAsCString();
206206

207207
ValueObjectSP payload_sp;
208-
if (variantCase.startswith("immortal")) {
208+
if (variantCase.starts_with("immortal")) {
209209
payload_sp = variant_sp->GetChildAtNamePath({g_immortal, g__value});
210-
} else if (variantCase.startswith("native")) {
210+
} else if (variantCase.starts_with("native")) {
211211
payload_sp = variant_sp->GetChildAtNamePath({g_immortal, g__value});
212-
} else if (variantCase.startswith("bridged")) {
212+
} else if (variantCase.starts_with("bridged")) {
213213
static ConstString g_bridged("bridged");
214214
auto anyobject_sp = variant_sp->GetChildMemberWithName(g_bridged, true);
215215
if (!anyobject_sp)
@@ -1211,27 +1211,27 @@ bool lldb_private::formatters::swift::LegacySIMD_SummaryProvider(
12111211
ConstString full_type_name = valobj.GetTypeName();
12121212

12131213
llvm::StringRef type_name = full_type_name.GetStringRef();
1214-
if (type_name.startswith("simd."))
1214+
if (type_name.starts_with("simd."))
12151215
type_name = type_name.drop_front(5);
1216-
if (type_name.startswith("simd_"))
1216+
if (type_name.starts_with("simd_"))
12171217
type_name = type_name.drop_front(5);
12181218

12191219
// Get the type of object this is.
1220-
bool is_quaternion = type_name.startswith("quat");
1220+
bool is_quaternion = type_name.starts_with("quat");
12211221
bool is_matrix = type_name[type_name.size() - 2] == 'x';
12221222
bool is_vector = !is_matrix && !is_quaternion;
12231223

12241224
// Get the kind of SIMD element inside of this object.
12251225
std::optional<SIMDElementKind> kind = std::nullopt;
1226-
if (type_name.startswith("int"))
1226+
if (type_name.starts_with("int"))
12271227
kind = SIMDElementKind::Int32;
1228-
else if (type_name.startswith("uint"))
1228+
else if (type_name.starts_with("uint"))
12291229
kind = SIMDElementKind::UInt32;
1230-
else if ((is_quaternion && type_name.endswith("f")) ||
1231-
type_name.startswith("float"))
1230+
else if ((is_quaternion && type_name.ends_with("f")) ||
1231+
type_name.starts_with("float"))
12321232
kind = SIMDElementKind::Float32;
1233-
else if ((is_quaternion && type_name.endswith("d")) ||
1234-
type_name.startswith("double"))
1233+
else if ((is_quaternion && type_name.ends_with("d")) ||
1234+
type_name.starts_with("double"))
12351235
kind = SIMDElementKind::Float64;
12361236
if (!kind)
12371237
return false;
@@ -1290,13 +1290,13 @@ bool lldb_private::formatters::swift::GLKit_SummaryProvider(
12901290
// Get the type name without the "GLKit." prefix.
12911291
ConstString full_type_name = valobj.GetTypeName();
12921292
llvm::StringRef type_name = full_type_name.GetStringRef();
1293-
if (type_name.startswith("GLKit."))
1293+
if (type_name.starts_with("GLKit."))
12941294
type_name = type_name.drop_front(6);
12951295

12961296
// Get the type of object this is.
12971297
bool is_quaternion = type_name == "GLKQuaternion";
1298-
bool is_matrix = type_name.startswith("GLKMatrix");
1299-
bool is_vector = type_name.startswith("GLKVector");
1298+
bool is_matrix = type_name.starts_with("GLKMatrix");
1299+
bool is_vector = type_name.starts_with("GLKVector");
13001300

13011301
if (!(is_quaternion || is_matrix || is_vector))
13021302
return false;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ bool
254254
HashedCollectionConfig::IsNativeStorageName(ConstString name) const {
255255
assert(m_nativeStorage_demangledPrefix);
256256
auto n = name.GetStringRef();
257-
return n.startswith(m_nativeStorage_demangledPrefix.GetStringRef());
257+
return n.starts_with(m_nativeStorage_demangledPrefix.GetStringRef());
258258
}
259259

260260
bool
@@ -267,7 +267,7 @@ bool
267267
HashedCollectionConfig::IsDeferredBridgedStorageName(ConstString name) const {
268268
assert(m_deferredBridgedStorage_demangledPrefix);
269269
auto n = name.GetStringRef();
270-
return n.startswith(m_deferredBridgedStorage_demangledPrefix.GetStringRef());
270+
return n.starts_with(m_deferredBridgedStorage_demangledPrefix.GetStringRef());
271271
}
272272

273273
HashedStorageHandlerUP
@@ -365,7 +365,7 @@ HashedCollectionConfig::CreateNativeHandler(
365365
return CreateEmptyHandler();
366366
}
367367

368-
if (typeName.startswith(m_nativeStorage_demangledPrefix.GetStringRef())) {
368+
if (typeName.starts_with(m_nativeStorage_demangledPrefix.GetStringRef())) {
369369
auto type_system = type.GetTypeSystem().dyn_cast_or_null<TypeSystemSwift>();
370370
if (!type_system)
371371
return nullptr;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ SwiftLanguage::GetHardcodedSummaries() {
720720
}
721721
llvm::StringRef tau_ = u8"$\u03C4_";
722722
if (valobj.GetName().GetLength() > 12 &&
723-
valobj.GetName().GetStringRef().startswith(tau_) &&
723+
valobj.GetName().GetStringRef().starts_with(tau_) &&
724724
type.GetTypeName() == g_RawPointerType) {
725725
if (!swift_metatype_summary_sp.get()) {
726726
TypeSummaryImpl::Flags flags;
@@ -1204,7 +1204,7 @@ SwiftLanguage::GetHardcodedSynthetics() {
12041204
}
12051205

12061206
bool SwiftLanguage::IsSourceFile(llvm::StringRef file_path) const {
1207-
return file_path.endswith(".swift");
1207+
return file_path.ends_with(".swift");
12081208
}
12091209

12101210
std::vector<FormattersMatchCandidate>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -664,9 +664,9 @@ GetLikelySwiftImageNamesForModule(ModuleSP module) {
664664
module->GetFileSpec().GetFileNameStrippingExtension().GetStringRef();
665665
if (name == "libswiftCore")
666666
name = "Swift";
667-
if (name.startswith("libswift"))
667+
if (name.starts_with("libswift"))
668668
name = name.drop_front(8);
669-
if (name.startswith("lib"))
669+
if (name.starts_with("lib"))
670670
name = name.drop_front(3);
671671
return {name};
672672
}
@@ -1142,7 +1142,7 @@ static bool IsSwiftResultVariable(ConstString name) {
11421142
if (name) {
11431143
llvm::StringRef name_sr(name.GetStringRef());
11441144
if (name_sr.size() > 2 &&
1145-
(name_sr.startswith("$R") || name_sr.startswith("$E")) &&
1145+
(name_sr.starts_with("$R") || name_sr.starts_with("$E")) &&
11461146
::isdigit(name_sr[2]))
11471147
return true;
11481148
}
@@ -2191,7 +2191,7 @@ class CommandObjectSwift_Demangle : public CommandObjectParsed {
21912191
NodePointer node_ptr = nullptr;
21922192
// Match the behavior of swift-demangle and accept Swift symbols without
21932193
// the leading `$`. This makes symbol copy & paste more convenient.
2194-
if (name.startswith("S") || name.startswith("s")) {
2194+
if (name.starts_with("S") || name.starts_with("s")) {
21952195
std::string correctedName = std::string("$") + name.str();
21962196
node_ptr =
21972197
SwiftLanguageRuntime::DemangleSymbolAsNode(correctedName, ctx);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ SwiftLanguageRuntimeImpl::GetIndexOfChildMemberWithName(
989989
// An existential is a three-word buffer followed by value metadata...
990990
// The buffer is exposed as children named `payload_data_{0,1,2}`, and
991991
// the number of fields are increased to match.
992-
if (name.startswith("payload_data_")) {
992+
if (name.starts_with("payload_data_")) {
993993
uint32_t index;
994994
if (name.take_back().getAsInteger(10, index) && index < 3) {
995995
child_indexes.push_back(index);
@@ -1771,8 +1771,8 @@ static bool IsPrivateNSClass(NodePointer node) {
17711771
return false;
17721772
for (NodePointer child : *classNode)
17731773
if (child->getKind() == Node::Kind::Identifier && child->hasText())
1774-
return child->getText().startswith("__NS") ||
1775-
child->getText().startswith("NSTaggedPointer");
1774+
return child->getText().starts_with("__NS") ||
1775+
child->getText().starts_with("NSTaggedPointer");
17761776
return false;
17771777
}
17781778

@@ -2604,7 +2604,7 @@ bool SwiftLanguageRuntimeImpl::GetDynamicTypeAndAddress_ClangType(
26042604
StringRef dyn_name = dyn_class_type_or_name.GetName().GetStringRef();
26052605
// If this is an Objective-C runtime value, skip; this is handled elsewhere.
26062606
if (swift::Demangle::isOldFunctionTypeMangling(dyn_name) ||
2607-
dyn_name.startswith("__NS"))
2607+
dyn_name.starts_with("__NS"))
26082608
return false;
26092609

26102610
SwiftNominalType swift_class;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,9 @@ bool SwiftLanguageRuntime::IsSwiftMangledName(llvm::StringRef name) {
635635
// ObjC classes and protocols. Classes are prefixed with either "_TtC" or
636636
// "_TtGC" (generic classes). Protocols are prefixed with "_TtP". Other "_T"
637637
// prefixed symbols are not considered to be Swift symbols.
638-
if (name.startswith("_T"))
639-
return name.startswith("_TtC") || name.startswith("_TtGC") ||
640-
name.startswith("_TtP");
638+
if (name.starts_with("_T"))
639+
return name.starts_with("_TtC") || name.starts_with("_TtGC") ||
640+
name.starts_with("_TtP");
641641
return swift::Demangle::isSwiftSymbol(name);
642642
}
643643

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ lldb::TypeSP DWARFASTParserSwift::ParseTypeFromDWARF(const SymbolContext &sc,
169169
if (!compiler_type && die.Tag() == DW_TAG_typedef) {
170170
// Handle Archetypes, which are typedefs to RawPointerType.
171171
llvm::StringRef typedef_name = GetTypedefName(die);
172-
if (typedef_name.startswith("$sBp")) {
172+
if (typedef_name.starts_with("$sBp")) {
173173
preferred_name = name;
174174
compiler_type = m_swift_typesystem.GetTypeFromMangledTypename(
175175
ConstString(typedef_name));

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ bool ConsumeIncludeOption(StringRef &arg, StringRef &prefix) {
15191519

15201520
// We need special handling for -fmodule-file as we need to
15211521
// split on the final = after the module name.
1522-
if (arg.startswith("-fmodule-file=")) {
1522+
if (arg.starts_with("-fmodule-file=")) {
15231523
prefix = arg.substr(0, arg.rfind("=") + 1);
15241524
arg.consume_front(prefix);
15251525
return true;
@@ -1543,14 +1543,14 @@ bool IsMultiArgClangFlag(StringRef arg) {
15431543

15441544
bool IsMacroDefinition(StringRef arg) {
15451545
for (auto &flag : macro_flags)
1546-
if (arg.startswith(flag))
1546+
if (arg.starts_with(flag))
15471547
return true;
15481548
return false;
15491549
}
15501550

15511551
bool ShouldUnique(StringRef arg) {
15521552
for (auto &flag : args_to_unique)
1553-
if (arg.startswith(flag))
1553+
if (arg.starts_with(flag))
15541554
return true;
15551555
return false;
15561556
}
@@ -1765,7 +1765,7 @@ void SwiftASTContext::ApplyWorkingDir(
17651765
// Ignore the option part of a double-arg include option.
17661766
if (arg.empty())
17671767
return;
1768-
} else if (arg.startswith("-")) {
1768+
} else if (arg.starts_with("-")) {
17691769
// Assume this is a compiler arg and not a path starting with "-".
17701770
return;
17711771
}
@@ -1853,7 +1853,7 @@ void SwiftASTContext::FilterClangImporterOptions(
18531853
// is not found. Since the Xcode build system tends to create a
18541854
// lot of VFS overlays by default, stat them and emit a warning if
18551855
// the yaml file couldn't be found.
1856-
if (arg_sr.startswith("-ivfs")) {
1856+
if (arg_sr.starts_with("-ivfs")) {
18571857
// Stash the argument.
18581858
ivfs_arg = arg;
18591859
continue;
@@ -2053,10 +2053,10 @@ ProcessModule(Module &module, std::string m_description,
20532053

20542054
// Never add framework paths pointing into the system. These
20552055
// modules must be imported from the SDK instead.
2056-
if (!p.startswith("/System/Library") && !IsDeviceSupport(p) &&
2057-
!p.startswith(
2056+
if (!p.starts_with("/System/Library") && !IsDeviceSupport(p) &&
2057+
!p.starts_with(
20582058
"/Library/Apple/System/Library/PrivateFrameworks") &&
2059-
!p.startswith("/System/iOSSupport/System/Library/Frameworks")) {
2059+
!p.starts_with("/System/iOSSupport/System/Library/Frameworks")) {
20602060
LOG_PRINTF(GetLog(LLDBLog::Types),
20612061
"adding framework path \"%s\"/.. .",
20622062
framework_path.c_str());

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,20 @@ lldb::Format TypeSystemSwift::GetFormat(opaque_compiler_type_t type) {
137137
return eFormatBytes;
138138
}
139139

140+
unsigned TypeSystemSwift::GetPtrAuthKey(lldb::opaque_compiler_type_t type) {
141+
return 0;
142+
}
143+
144+
unsigned
145+
TypeSystemSwift::GetPtrAuthDiscriminator(lldb::opaque_compiler_type_t type) {
146+
return 0;
147+
}
148+
149+
bool TypeSystemSwift::GetPtrAuthAddressDiversity(
150+
lldb::opaque_compiler_type_t type) {
151+
return false;
152+
}
153+
140154
namespace llvm {
141155
llvm::raw_ostream &
142156
operator<<(llvm::raw_ostream &os,

0 commit comments

Comments
 (0)