Skip to content

Commit 567181d

Browse files
committed
Fix nondeterminism in VALIDATE_AND_RETURN caused by comparing uninitialized values
1 parent 1c18d12 commit 567181d

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2490,6 +2490,14 @@ CompilerType TypeSystemSwiftTypeRef::GetChildCompilerTypeAtIndex(
24902490
bool &child_is_base_class, bool &child_is_deref_of_parent,
24912491
ValueObject *valobj, uint64_t &language_flags) {
24922492
LLDB_SCOPED_TIMER();
2493+
child_name = "";
2494+
child_byte_size = 0;
2495+
child_byte_offset = 0;
2496+
child_bitfield_bit_size = 0;
2497+
child_bitfield_bit_offset = 0;
2498+
child_is_base_class = false;
2499+
child_is_deref_of_parent = false;
2500+
language_flags = 0;
24932501
auto fallback = [&]() -> CompilerType {
24942502
LLDB_LOGF(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES),
24952503
"Had to engage SwiftASTContext fallback for type %s.",
@@ -2648,13 +2656,13 @@ CompilerType TypeSystemSwiftTypeRef::GetChildCompilerTypeAtIndex(
26482656

26492657
#ifndef NDEBUG
26502658
std::string ast_child_name;
2651-
uint32_t ast_child_byte_size;
2652-
int32_t ast_child_byte_offset;
2653-
uint32_t ast_child_bitfield_bit_size;
2654-
uint32_t ast_child_bitfield_bit_offset;
2655-
bool ast_child_is_base_class;
2656-
bool ast_child_is_deref_of_parent;
2657-
uint64_t ast_language_flags;
2659+
uint32_t ast_child_byte_size = 0;
2660+
int32_t ast_child_byte_offset = 0;
2661+
uint32_t ast_child_bitfield_bit_size = 0;
2662+
uint32_t ast_child_bitfield_bit_offset = 0;
2663+
bool ast_child_is_base_class = false;
2664+
bool ast_child_is_deref_of_parent = false;
2665+
uint64_t ast_language_flags = 0;
26582666
auto defer = llvm::make_scope_exit([&] {
26592667
if (!ModuleList::GetGlobalModuleListProperties()
26602668
.GetSwiftValidateTypeSystem())

0 commit comments

Comments
 (0)