Skip to content

Commit cf40296

Browse files
authored
Merge pull request #3541 from bnbarham/rebranch-fixes
Various warning and compilation fixes for stable/20211026
2 parents 0f38a40 + a54c6c1 commit cf40296

24 files changed

+2965
-1360
lines changed

clang/include/indexstore/indexstore.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ typedef enum {
270270
INDEXSTORE_SYMBOL_SUBKIND_ACCESSORSETTER = 4,
271271
INDEXSTORE_SYMBOL_SUBKIND_USINGTYPENAME = 5,
272272
INDEXSTORE_SYMBOL_SUBKIND_USINGVALUE = 6,
273+
INDEXSTORE_SYMBOL_SUBKIND_USINGENUM = 7,
273274

274275
INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORWILLSET = 1000,
275276
INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORDIDSET = 1001,

clang/lib/Index/IndexDataStoreUtils.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ SymbolSubKind index::getSymbolSubKind(indexstore_symbol_subkind_t K) {
153153
return SymbolSubKind::UsingTypename;
154154
case INDEXSTORE_SYMBOL_SUBKIND_USINGVALUE:
155155
return SymbolSubKind::UsingValue;
156+
case INDEXSTORE_SYMBOL_SUBKIND_USINGENUM:
157+
return SymbolSubKind::UsingEnum;
156158
case INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORWILLSET:
157159
return SymbolSubKind::SwiftAccessorWillSet;
158160
case INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORDIDSET:
@@ -377,6 +379,8 @@ indexstore_symbol_subkind_t index::getIndexStoreSubKind(SymbolSubKind K) {
377379
return INDEXSTORE_SYMBOL_SUBKIND_USINGTYPENAME;
378380
case SymbolSubKind::UsingValue:
379381
return INDEXSTORE_SYMBOL_SUBKIND_USINGVALUE;
382+
case SymbolSubKind::UsingEnum:
383+
return INDEXSTORE_SYMBOL_SUBKIND_USINGENUM;
380384
case SymbolSubKind::SwiftAccessorWillSet:
381385
return INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORWILLSET;
382386
case SymbolSubKind::SwiftAccessorDidSet:

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

Lines changed: 1961 additions & 1036 deletions
Large diffs are not rendered by default.

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

Lines changed: 878 additions & 138 deletions
Large diffs are not rendered by default.

lldb/source/Core/ModuleList.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ void ModuleList::FindFunctions(const RegularExpression &name,
514514
if (keep_looking) {
515515
end = dylinker_modules.end();
516516
for (pos = dylinker_modules.begin(); pos != end; pos++)
517-
(*pos)->FindFunctions(name, include_symbols, include_inlines, sc_list);
517+
(*pos)->FindFunctions(name, options, sc_list);
518518
}
519519
// END SWIFT
520520
}

lldb/source/Core/SourceManager.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,12 @@ static lldb_private::LineEntry FindEntryPoint(Module *exe_module) {
350350
const ConstString entry_point_name = entry_point.first;
351351
const bool skip_prologue = entry_point.second;
352352
SymbolContextList sc_list;
353-
bool symbols_okay = false; // Force it to be a debug symbol.
354-
bool inlines_okay = true;
353+
ModuleFunctionSearchOptions function_options;
354+
function_options.include_symbols = false; // Force it to be a debug symbol
355+
function_options.include_inlines = true;
355356
exe_module->FindFunctions(entry_point_name, CompilerDeclContext(),
356-
lldb::eFunctionNameTypeBase, inlines_okay,
357-
symbols_okay, sc_list);
357+
lldb::eFunctionNameTypeBase, function_options,
358+
sc_list);
358359
size_t num_matches = sc_list.GetSize();
359360
for (size_t idx = 0; idx < num_matches; idx++) {
360361
SymbolContext sc;

lldb/source/Core/ValueObjectVariable.cpp

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -215,50 +215,6 @@ bool ValueObjectVariable::UpdateValue() {
215215

216216
Process *process = exe_ctx.GetProcessPtr();
217217
const bool process_is_alive = process && process->IsAlive();
218-
const uint32_t type_info = compiler_type.GetTypeInfo();
219-
const bool is_pointer_or_ref =
220-
(type_info & (lldb::eTypeIsPointer | lldb::eTypeIsReference)) != 0;
221-
222-
switch (value_type) {
223-
case Value::ValueType::FileAddress:
224-
// If this type is a pointer, then its children will be considered load
225-
// addresses if the pointer or reference is dereferenced, but only if
226-
// the process is alive.
227-
//
228-
// There could be global variables like in the following code:
229-
// struct LinkedListNode { Foo* foo; LinkedListNode* next; };
230-
// Foo g_foo1;
231-
// Foo g_foo2;
232-
// LinkedListNode g_second_node = { &g_foo2, NULL };
233-
// LinkedListNode g_first_node = { &g_foo1, &g_second_node };
234-
//
235-
// When we aren't running, we should be able to look at these variables
236-
// using the "target variable" command. Children of the "g_first_node"
237-
// always will be of the same address type as the parent. But children
238-
// of the "next" member of LinkedListNode will become load addresses if
239-
// we have a live process, or remain what a file address if it what a
240-
// file address.
241-
if (process_is_alive && is_pointer_or_ref)
242-
SetAddressTypeOfChildren(eAddressTypeLoad);
243-
else
244-
SetAddressTypeOfChildren(eAddressTypeFile);
245-
break;
246-
case Value::ValueType::HostAddress:
247-
// Same as above for load addresses, except children of pointer or refs
248-
// are always load addresses. Host addresses are used to store freeze
249-
// dried variables. If this type is a struct, the entire struct
250-
// contents will be copied into the heap of the
251-
// LLDB process, but we do not currently follow any pointers.
252-
if (is_pointer_or_ref)
253-
SetAddressTypeOfChildren(eAddressTypeLoad);
254-
else
255-
SetAddressTypeOfChildren(eAddressTypeHost);
256-
break;
257-
case Value::ValueType::LoadAddress:
258-
case Value::ValueType::Scalar:
259-
SetAddressTypeOfChildren(eAddressTypeLoad);
260-
break;
261-
}
262218

263219
#ifdef LLDB_ENABLE_SWIFT
264220
if (auto type = variable->GetType())

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,8 +1392,9 @@ bool SwiftASTManipulator::SaveExpressionTextToTempFile(
13921392
std::error_code err =
13931393
llvm::sys::fs::createTemporaryFile(prefix, suffix, temp_fd, buffer);
13941394
if (!err) {
1395-
lldb_private::NativeFile file(temp_fd, /*options*/ File::eOpenOptionWrite,
1396-
/*transfer_ownership*/ true);
1395+
lldb_private::NativeFile file(temp_fd,
1396+
/*options*/ File::eOpenOptionWriteOnly,
1397+
/*transfer_ownership*/ true);
13971398
const size_t text_len = text.size();
13981399
size_t bytes_written = text_len;
13991400
if (file.Write(text.data(), bytes_written).Success()) {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ bool SwiftExpressionSourceCode::GetText(
8383
if (auto process_sp = exe_ctx.GetProcessSP()) {
8484
os_vers << getAvailabilityName(triple) << " ";
8585
auto platform = target->GetPlatform();
86-
bool is_simulator =
87-
platform->GetPluginName().GetStringRef().endswith("-simulator");
86+
bool is_simulator = platform->GetPluginName().endswith("-simulator");
8887
if (is_simulator) {
8988
// The simulators look like the host OS to Process, but Platform
9089
// can the version out of an environment variable.

lldb/source/Plugins/InstrumentationRuntime/SwiftRuntimeReporting/SwiftRuntimeReporting.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ namespace lldb_private {
3030
static lldb_private::ConstString GetPluginNameStatic();
3131

3232
static lldb::InstrumentationRuntimeType GetTypeStatic();
33-
34-
lldb_private::ConstString GetPluginName() override {
35-
return GetPluginNameStatic();
33+
34+
llvm::StringRef GetPluginName() override {
35+
return GetPluginNameStatic().GetStringRef();
3636
}
37-
37+
3838
virtual lldb::InstrumentationRuntimeType GetType() { return GetTypeStatic(); }
3939

4040
lldb::ThreadCollectionSP

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,17 +277,16 @@ bool lldb_private::formatters::swift::StringGuts_SummaryProvider(
277277
return false;
278278

279279
uint64_t buffer[2] = {raw0, raw1};
280-
DataExtractor data(buffer, count, process->GetByteOrder(), ptrSize);
281280

282281
StringPrinter::ReadBufferAndDumpToStreamOptions options(read_options);
283-
options.SetData(data);
282+
options.SetData(
283+
DataExtractor(buffer, count, process->GetByteOrder(), ptrSize));
284284
options.SetStream(&stream);
285285
options.SetSourceSize(count);
286286
options.SetBinaryZeroIsTerminator(false);
287287
options.SetEscapeStyle(StringPrinter::EscapeStyle::Swift);
288288
return StringPrinter::ReadBufferAndDumpToStream<
289289
StringPrinter::StringElementType::UTF8>(options);
290-
291290
}
292291

293292
uint64_t count = raw0 & 0x0000FFFFFFFFFFFF;

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

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,8 @@ lldb::TypeCategoryImplSP SwiftLanguage::GetFormatters() {
669669
static TypeCategoryImplSP g_category;
670670

671671
std::call_once(g_initialize, [this]() -> void {
672-
DataVisualization::Categories::GetCategory(GetPluginName(), g_category);
672+
DataVisualization::Categories::GetCategory(ConstString(GetPluginName()),
673+
g_category);
673674
if (g_category) {
674675
LoadSwiftFormatters(g_category);
675676
LoadFoundationValueTypesFormatters(g_category);
@@ -1484,29 +1485,23 @@ void SwiftLanguage::GetExceptionResolverDescription(bool catch_on,
14841485
}
14851486

14861487
ConstString SwiftLanguage::GetDemangledFunctionNameWithoutArguments(Mangled mangled) const {
1487-
const char *mangled_name_cstr = mangled.GetMangledName().GetCString();
1488+
ConstString mangled_name = mangled.GetMangledName();
14881489
ConstString demangled_name = mangled.GetDemangledName();
1489-
if (demangled_name && mangled_name_cstr && mangled_name_cstr[0]) {
1490-
if (SwiftLanguageRuntime::IsSwiftMangledName(demangled.GetStringRef())) {
1490+
if (demangled_name && mangled_name) {
1491+
if (SwiftLanguageRuntime::IsSwiftMangledName(
1492+
demangled_name.GetStringRef())) {
14911493
lldb_private::ConstString basename;
14921494
bool is_method = false;
14931495
if (SwiftLanguageRuntime::MethodName::ExtractFunctionBasenameFromMangled(
1494-
mangled, basename, is_method)) {
1495-
if (basename && basename != mangled)
1496-
return basename);
1496+
mangled_name, basename, is_method)) {
1497+
if (basename && basename != mangled_name)
1498+
return basename;
14971499
}
14981500
}
14991501
}
15001502
if (demangled_name)
15011503
return demangled_name;
1502-
return mangled.GetMangledName();
1503-
}
1504-
1505-
//------------------------------------------------------------------
1506-
// PluginInterface protocol
1507-
//------------------------------------------------------------------
1508-
lldb_private::ConstString SwiftLanguage::GetPluginName() {
1509-
return GetPluginNameStatic();
1504+
return mangled_name;
15101505
}
15111506

15121507
//------------------------------------------------------------------

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ class SwiftLanguage : public Language {
9191
//------------------------------------------------------------------
9292
// PluginInterface protocol
9393
//------------------------------------------------------------------
94-
virtual ConstString GetPluginName() override;
94+
llvm::StringRef GetPluginName() override {
95+
return GetPluginNameStatic().GetStringRef();
96+
}
9597
};
9698

9799
} // namespace lldb_private

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ AppleObjCRuntimeV2 *
9797
SwiftLanguageRuntime::GetObjCRuntime(lldb_private::Process &process) {
9898
if (auto objc_runtime = ObjCLanguageRuntime::Get(process)) {
9999
if (objc_runtime->GetPluginName() ==
100-
AppleObjCRuntimeV2::GetPluginNameStatic())
100+
AppleObjCRuntimeV2::GetPluginNameStatic().GetStringRef())
101101
return (AppleObjCRuntimeV2 *)objc_runtime;
102102
}
103103
return nullptr;
@@ -146,7 +146,7 @@ FindSymbolForSwiftObject(Process &process, RuntimeKind runtime_kind,
146146
if (runtime_kind == RuntimeKind::ObjC) {
147147
auto *obj_file = target.GetExecutableModule()->GetObjectFile();
148148
bool have_objc_interop =
149-
obj_file && obj_file->GetPluginName().GetStringRef().equals("mach-o");
149+
obj_file && obj_file->GetPluginName().equals("mach-o");
150150
if (!have_objc_interop)
151151
return {};
152152
}
@@ -626,7 +626,7 @@ bool SwiftLanguageRuntimeImpl::AddModuleToReflectionContext(
626626

627627
// When dealing with ELF, we need to pass in the contents of the on-disk
628628
// file, since the Section Header Table is not present in the child process
629-
if (obj_file->GetPluginName().GetStringRef().equals("elf")) {
629+
if (obj_file->GetPluginName().equals("elf")) {
630630
DataExtractor extractor;
631631
auto size = obj_file->GetData(0, obj_file->GetByteSize(), extractor);
632632
const uint8_t *file_data = extractor.GetDataStart();
@@ -2009,10 +2009,6 @@ lldb_private::ConstString SwiftLanguageRuntime::GetPluginNameStatic() {
20092009
return g_name;
20102010
}
20112011

2012-
lldb_private::ConstString SwiftLanguageRuntime::GetPluginName() {
2013-
return GetPluginNameStatic();
2014-
}
2015-
20162012
#define FORWARD(METHOD, ...) \
20172013
assert(m_impl || m_stub); \
20182014
return m_impl ? m_impl->METHOD(__VA_ARGS__) : m_stub->METHOD(__VA_ARGS__);

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ class SwiftLanguageRuntime : public LanguageRuntime {
108108
/// \}
109109

110110
/// PluginInterface protocol.
111-
lldb_private::ConstString GetPluginName() override;
111+
llvm::StringRef GetPluginName() override {
112+
return GetPluginNameStatic().GetStringRef();
113+
}
112114

113115
bool GetObjectDescription(Stream &str, Value &value,
114116
ExecutionContextScope *exe_scope) override {

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ class ThreadPlanStepInAsync : public ThreadPlan {
319319

320320
bool StopOthers() override { return false; }
321321

322-
void WillPop() override {
322+
void DidPop() override {
323323
if (m_async_breakpoint_sp)
324324
m_async_breakpoint_sp->GetTarget().RemoveBreakpointByID(
325325
m_async_breakpoint_sp->GetID());
@@ -1105,9 +1105,12 @@ bool SwiftLanguageRuntime::GetTargetOfPartialApply(SymbolContext &curr_sc,
11051105
std::string apply_target =
11061106
demangle_ctx.getThunkTarget(apply_name.GetStringRef());
11071107
if (!apply_target.empty()) {
1108-
curr_sc.module_sp->FindFunctions(ConstString(apply_target), CompilerDeclContext(),
1109-
eFunctionNameTypeFull, true, false,
1110-
sc_list);
1108+
ModuleFunctionSearchOptions function_options;
1109+
function_options.include_symbols = true;
1110+
function_options.include_inlines = false;
1111+
curr_sc.module_sp->FindFunctions(
1112+
ConstString(apply_target), CompilerDeclContext(), eFunctionNameTypeFull,
1113+
function_options, sc_list);
11111114
size_t num_symbols = sc_list.GetSize();
11121115
if (num_symbols == 0)
11131116
return false;

0 commit comments

Comments
 (0)