Skip to content

Commit 3c39a68

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:fd4c80dec929 into amd-gfx:291c2654279d
Local branch amd-gfx 291c265 Merged main:3df1a64ebad8 into amd-gfx:efed4dce5ec1 Remote branch main fd4c80d [OpenMP] Fix gettid warnings on DragonFly (llvm#65549)
2 parents 291c265 + fd4c80d commit 3c39a68

File tree

10 files changed

+75
-19
lines changed

10 files changed

+75
-19
lines changed

lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,20 @@ def test_indexedVariables(self):
517517
}
518518
self.verify_variables(verify_locals, locals)
519519

520+
# We also verify that we produce a "[raw]" fake child with the real
521+
# SBValue for the synthetic type.
522+
verify_children = {
523+
"[0]": {"equals": {"type": "int", "value": "0"}},
524+
"[1]": {"equals": {"type": "int", "value": "0"}},
525+
"[2]": {"equals": {"type": "int", "value": "0"}},
526+
"[3]": {"equals": {"type": "int", "value": "0"}},
527+
"[4]": {"equals": {"type": "int", "value": "0"}},
528+
"[raw]": {"contains": {"type": ["vector"]}},
529+
}
530+
children = self.vscode.request_variables(locals[2]["variablesReference"])["body"]["variables"]
531+
self.verify_variables(verify_children, children)
532+
533+
520534
@skipIfWindows
521535
@skipIfRemote
522536
def test_registers(self):

lldb/tools/lldb-vscode/JSONUtils.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,10 +1103,13 @@ std::string CreateUniqueVariableNameForDisplay(lldb::SBValue v,
11031103
// }
11041104
llvm::json::Value CreateVariable(lldb::SBValue v, int64_t variablesReference,
11051105
int64_t varID, bool format_hex,
1106-
bool is_name_duplicated) {
1106+
bool is_name_duplicated,
1107+
std::optional<std::string> custom_name) {
11071108
llvm::json::Object object;
1108-
EmplaceSafeString(object, "name",
1109-
CreateUniqueVariableNameForDisplay(v, is_name_duplicated));
1109+
EmplaceSafeString(
1110+
object, "name",
1111+
custom_name ? *custom_name
1112+
: CreateUniqueVariableNameForDisplay(v, is_name_duplicated));
11101113

11111114
if (format_hex)
11121115
v.SetFormat(lldb::eFormatHex);
@@ -1131,15 +1134,19 @@ llvm::json::Value CreateVariable(lldb::SBValue v, int64_t variablesReference,
11311134
const bool is_synthetic = v.IsSynthetic();
11321135
if (is_array || is_synthetic) {
11331136
const auto num_children = v.GetNumChildren();
1137+
// We create a "[raw]" fake child for each synthetic type, so we have to
1138+
// account for it when returning indexed variables. We don't need to do this
1139+
// for non-indexed ones.
1140+
int actual_num_children = num_children + (is_synthetic ? 1 : 0);
11341141
if (is_array) {
1135-
object.try_emplace("indexedVariables", num_children);
1142+
object.try_emplace("indexedVariables", actual_num_children);
11361143
} else if (num_children > 0) {
11371144
// If a type has a synthetic child provider, then the SBType of "v" won't
11381145
// tell us anything about what might be displayed. So we can check if the
11391146
// first child's name is "[0]" and then we can say it is indexed.
11401147
const char *first_child_name = v.GetChildAtIndex(0).GetName();
11411148
if (first_child_name && strcmp(first_child_name, "[0]") == 0)
1142-
object.try_emplace("indexedVariables", num_children);
1149+
object.try_emplace("indexedVariables", actual_num_children);
11431150
}
11441151
}
11451152
EmplaceSafeString(object, "type", type_cstr ? type_cstr : NO_TYPENAME);

lldb/tools/lldb-vscode/JSONUtils.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,12 +440,17 @@ std::string CreateUniqueVariableNameForDisplay(lldb::SBValue v,
440440
/// As VSCode doesn't render two of more variables with the same name, we
441441
/// apply a suffix to distinguish duplicated variables.
442442
///
443+
/// \param[in] custom_name
444+
/// A provided custom name that is used instead of the SBValue's when
445+
/// creating the JSON representation.
446+
///
443447
/// \return
444448
/// A "Variable" JSON object with that follows the formal JSON
445449
/// definition outlined by Microsoft.
446450
llvm::json::Value CreateVariable(lldb::SBValue v, int64_t variablesReference,
447451
int64_t varID, bool format_hex,
448-
bool is_name_duplicated = false);
452+
bool is_name_duplicated = false,
453+
std::optional<std::string> custom_name = {});
449454

450455
llvm::json::Value CreateCompileUnit(lldb::SBCompileUnit unit);
451456

lldb/tools/lldb-vscode/lldb-vscode.cpp

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3251,7 +3251,7 @@ void request_variables(const llvm::json::Object &request) {
32513251
break;
32523252

32533253
int64_t var_ref = 0;
3254-
if (variable.MightHaveChildren()) {
3254+
if (variable.MightHaveChildren() || variable.IsSynthetic()) {
32553255
var_ref = g_vsc.variables.InsertExpandableVariable(
32563256
variable, /*is_permanent=*/false);
32573257
}
@@ -3264,23 +3264,36 @@ void request_variables(const llvm::json::Object &request) {
32643264
// children.
32653265
lldb::SBValue variable = g_vsc.variables.GetVariable(variablesReference);
32663266
if (variable.IsValid()) {
3267-
const auto num_children = variable.GetNumChildren();
3268-
const int64_t end_idx = start + ((count == 0) ? num_children : count);
3269-
for (auto i = start; i < end_idx; ++i) {
3270-
lldb::SBValue child = variable.GetChildAtIndex(i);
3267+
auto addChild = [&](lldb::SBValue child,
3268+
std::optional<std::string> custom_name = {}) {
32713269
if (!child.IsValid())
3272-
break;
3270+
return;
32733271
if (child.MightHaveChildren()) {
32743272
auto is_permanent =
32753273
g_vsc.variables.IsPermanentVariableReference(variablesReference);
32763274
auto childVariablesReferences =
32773275
g_vsc.variables.InsertExpandableVariable(child, is_permanent);
3278-
variables.emplace_back(CreateVariable(child, childVariablesReferences,
3279-
childVariablesReferences, hex));
3276+
variables.emplace_back(CreateVariable(
3277+
child, childVariablesReferences, childVariablesReferences, hex,
3278+
/*is_name_duplicated=*/false, custom_name));
32803279
} else {
3281-
variables.emplace_back(CreateVariable(child, 0, INT64_MAX, hex));
3280+
variables.emplace_back(CreateVariable(child, 0, INT64_MAX, hex,
3281+
/*is_name_duplicated=*/false,
3282+
custom_name));
32823283
}
3283-
}
3284+
};
3285+
const int64_t num_children = variable.GetNumChildren();
3286+
int64_t end_idx = start + ((count == 0) ? num_children : count);
3287+
int64_t i = start;
3288+
for (; i < end_idx && i < num_children; ++i)
3289+
addChild(variable.GetChildAtIndex(i));
3290+
3291+
// If we haven't filled the count quota from the request, we insert a new
3292+
// "[raw]" child that can be used to inspect the raw version of a
3293+
// synthetic member. That eliminates the need for the user to go to the
3294+
// debug console and type `frame var <variable> to get these values.
3295+
if (variable.IsSynthetic() && i == num_children)
3296+
addChild(variable.GetNonSyntheticValue(), "[raw]");
32843297
}
32853298
}
32863299
llvm::json::Object body;

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 473792
19+
#define LLVM_MAIN_REVISION 473796
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

llvm/utils/gn/secondary/libcxx/config.gni

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ declare_args() {
44

55
# libc++ inline ABI namespace. Defaults to __n, where n is the ABI version.
66
libcxx_abi_namespace = ""
7+
8+
# Build timezone database as part of libc++experimental.
9+
libcxx_enable_time_zone_database = target_os == "linux"
710
}

llvm/utils/gn/secondary/libcxx/include/BUILD.gn

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ if (current_toolchain == default_toolchain) {
5151
} else {
5252
values += [ "_LIBCPP_ABI_NAMESPACE=__" + libcxx_abi_version ]
5353
}
54+
if (!libcxx_enable_time_zone_database) {
55+
values += [ "_LIBCPP_HAS_NO_TIME_ZONE_DATABASE=1" ]
56+
} else {
57+
values += [ "_LIBCPP_HAS_NO_TIME_ZONE_DATABASE=" ]
58+
}
5459
}
5560

5661
write_cmake_config("write_modulemap") {
@@ -351,6 +356,8 @@ if (current_toolchain == default_toolchain) {
351356
"__chrono/steady_clock.h",
352357
"__chrono/system_clock.h",
353358
"__chrono/time_point.h",
359+
"__chrono/tzdb.h",
360+
"__chrono/tzdb_list.h",
354361
"__chrono/weekday.h",
355362
"__chrono/year.h",
356363
"__chrono/year_month.h",

llvm/utils/gn/secondary/libcxx/src/BUILD.gn

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ declare_args() {
1212
# Build libc++ as a static library.
1313
libcxx_enable_static = true
1414

15-
# Build filesystem as part of libc++fs.a.
15+
# Build filesystem as part of libc++.
1616
libcxx_enable_filesystem = target_os != "win"
1717

1818
# Build libc++experimental.a.
@@ -307,6 +307,12 @@ if (libcxx_enable_experimental) {
307307
output_dir = runtimes_dir
308308
output_name = "c++experimental"
309309
sources = [ "experimental/memory_resource.cpp" ]
310+
if (libcxx_enable_filesystem && libcxx_enable_time_zone_database) {
311+
sources += [
312+
"tz.cpp",
313+
"tzdb_list.cpp",
314+
]
315+
}
310316
deps = [ "//libcxx/include" ]
311317
configs += [ ":cxx_config" ]
312318
configs -= [

mlir/utils/lldb-scripts/mlirDataFormatters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ def __init__(self, valobj: lldb.SBValue, internal_dict):
196196
valobj, self.abstractVal, internal_dict
197197
)
198198
if not self.type:
199+
self.impl_type = None
199200
return
200201

201202
# Grab the ImplTy from the resolved type. This is the 3rd template

openmp/runtime/src/kmp_wrapper_getpid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#if KMP_OS_DARWIN
2424
// OS X
2525
#define __kmp_gettid() pthread_mach_thread_np(pthread_self())
26-
#elif KMP_OS_FREEBSD
26+
#elif KMP_OS_FREEBSD || KMP_OS_DRAGONFLY
2727
#include <pthread_np.h>
2828
#define __kmp_gettid() pthread_getthreadid_np()
2929
#elif KMP_OS_NETBSD

0 commit comments

Comments
 (0)