[Lldb-commits] [lldb] r352548 - Make a blind attempt at fixing PDBASTParser nullability issues

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 29 13:46:34 PST 2019


Author: adrian
Date: Tue Jan 29 13:46:34 2019
New Revision: 352548

URL: http://llvm.org/viewvc/llvm-project?rev=352548&view=rev
Log:
Make a blind attempt at fixing PDBASTParser nullability issues

Modified:
    lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp?rev=352548&r1=352547&r2=352548&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp Tue Jan 29 13:46:34 2019
@@ -649,7 +649,9 @@ lldb::TypeSP PDBASTParser::CreateLLDBTyp
     assert(array_type);
     uint32_t num_elements = array_type->getCount();
     uint32_t element_uid = array_type->getElementTypeId();
-    uint32_t bytes = array_type->getLength();
+    llvm::Optional<uint64_t> bytes;
+    if (uint64_t size = array_type->getLength())
+      bytes = size;
 
     // If array rank > 0, PDB gives the element type at N=0. So element type
     // will parsed in the order N=0, N=1,..., N=rank sequentially.
@@ -685,7 +687,9 @@ lldb::TypeSP PDBASTParser::CreateLLDBTyp
     if (builtin_kind == PDB_BuiltinType::None)
       return nullptr;
 
-    llvm::Optional<uint64_t> bytes = builtin_type->getLength();
+    llvm::Optional<uint64_t> bytes;
+    if (uint64_t size = builtin_type->getLength())
+      bytes = size;
     Encoding encoding = TranslateBuiltinEncoding(builtin_kind);
     CompilerType builtin_ast_type = GetBuiltinTypeForPDBEncodingAndBitSize(
         m_ast, *builtin_type, encoding, bytes.getValueOr(0) * 8);




More information about the lldb-commits mailing list