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);


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to