forked from OSchip/llvm-project
[utils] Fix the llvm::Optional data formatter
The llvm::Optional data formatter needs to look through the `Storage` container if it's present. Before: 220 if (Op && Op->getOp() != dwarf::DW_OP_LLVM_fragment) -> 221 HasComplexExpression = true; 222 223 // If the register can only be described by a complex expression (i.e., 224 // multiple subregisters) it doesn't safely compose with another complex Target 0: (llc) stopped. (lldb) p Op (llvm::Optional<llvm::DIExpression::ExprOperand>) $0 = None After: (lldb) p Op (llvm::Optional<llvm::DIExpression::ExprOperand>) $0 = (llvm::DIExpression::ExprOperand) storage = { Op = 0x000000010603d460 } llvm-svn: 337752
This commit is contained in:
parent
22bd6f99fa
commit
0970e2e34f
|
@ -91,8 +91,18 @@ class ArrayRefSynthProvider:
|
|||
assert self.type_size != 0
|
||||
|
||||
def OptionalSummaryProvider(valobj, internal_dict):
|
||||
if not valobj.GetChildMemberWithName('hasVal').GetValueAsUnsigned(0):
|
||||
storage = valobj.GetChildMemberWithName('Storage')
|
||||
if not storage:
|
||||
storage = valobj
|
||||
|
||||
failure = 2
|
||||
hasVal = storage.GetChildMemberWithName('hasVal').GetValueAsUnsigned(failure)
|
||||
if hasVal == failure:
|
||||
return '<could not read llvm::Optional>'
|
||||
|
||||
if hasVal == 0:
|
||||
return 'None'
|
||||
underlying_type = valobj.GetType().GetTemplateArgumentType(0)
|
||||
storage = valobj.GetChildMemberWithName('storage')
|
||||
|
||||
underlying_type = storage.GetType().GetTemplateArgumentType(0)
|
||||
storage = storage.GetChildMemberWithName('storage')
|
||||
return str(storage.Cast(underlying_type))
|
||||
|
|
Loading…
Reference in New Issue