Skip to content

Commit d55102a

Browse files
committed
Make a blind attempt at fixing PDBASTParser nullability issues
llvm-svn: 352548
1 parent 102c9ed commit d55102a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,9 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
649649
assert(array_type);
650650
uint32_t num_elements = array_type->getCount();
651651
uint32_t element_uid = array_type->getElementTypeId();
652-
uint32_t bytes = array_type->getLength();
652+
llvm::Optional<uint64_t> bytes;
653+
if (uint64_t size = array_type->getLength())
654+
bytes = size;
653655

654656
// If array rank > 0, PDB gives the element type at N=0. So element type
655657
// will parsed in the order N=0, N=1,..., N=rank sequentially.
@@ -685,7 +687,9 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
685687
if (builtin_kind == PDB_BuiltinType::None)
686688
return nullptr;
687689

688-
llvm::Optional<uint64_t> bytes = builtin_type->getLength();
690+
llvm::Optional<uint64_t> bytes;
691+
if (uint64_t size = builtin_type->getLength())
692+
bytes = size;
689693
Encoding encoding = TranslateBuiltinEncoding(builtin_kind);
690694
CompilerType builtin_ast_type = GetBuiltinTypeForPDBEncodingAndBitSize(
691695
m_ast, *builtin_type, encoding, bytes.getValueOr(0) * 8);

0 commit comments

Comments
 (0)