Minor cleanup of SBTypeSummary::CreateWithCallback to take an optional description argument
llvm-svn: 251377
This commit is contained in:
parent
9e9cf54eb2
commit
e7cbaf3e0e
|
@ -87,7 +87,8 @@ namespace lldb {
|
|||
|
||||
static SBTypeSummary
|
||||
CreateWithCallback (FormatCallback cb,
|
||||
uint32_t options = 0);
|
||||
uint32_t options = 0,
|
||||
const char* description = nullptr);
|
||||
|
||||
SBTypeSummary (const lldb::SBTypeSummary &rhs);
|
||||
|
||||
|
|
|
@ -147,22 +147,25 @@ SBTypeSummary::CreateWithScriptCode (const char* data, uint32_t options)
|
|||
}
|
||||
|
||||
SBTypeSummary
|
||||
SBTypeSummary::CreateWithCallback (FormatCallback cb, uint32_t options)
|
||||
SBTypeSummary::CreateWithCallback (FormatCallback cb, uint32_t options, const char* description)
|
||||
{
|
||||
return SBTypeSummary(
|
||||
TypeSummaryImplSP(
|
||||
cb ? new CXXFunctionSummaryFormat(options,
|
||||
[cb] (ValueObject& valobj, Stream& stm, const TypeSummaryOptions& opt) -> bool {
|
||||
SBStream stream;
|
||||
if (!cb(SBValue(valobj.GetSP()), SBTypeSummaryOptions(&opt), stream))
|
||||
return false;
|
||||
stm.Write(stream.GetData(), stream.GetSize());
|
||||
return true;
|
||||
},
|
||||
"SBTypeSummary formatter callback"
|
||||
) : nullptr
|
||||
)
|
||||
);
|
||||
SBTypeSummary retval;
|
||||
if (cb)
|
||||
{
|
||||
retval.SetSP(TypeSummaryImplSP(new CXXFunctionSummaryFormat(options,
|
||||
[cb] (ValueObject& valobj, Stream& stm, const TypeSummaryOptions& opt) -> bool {
|
||||
SBStream stream;
|
||||
SBValue sb_value(valobj.GetSP());
|
||||
SBTypeSummaryOptions options(&opt);
|
||||
if (!cb(sb_value, options, stream))
|
||||
return false;
|
||||
stm.Write(stream.GetData(), stream.GetSize());
|
||||
return true;
|
||||
},
|
||||
description ? description : "callback summary formatter")));
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
SBTypeSummary::SBTypeSummary (const lldb::SBTypeSummary &rhs) :
|
||||
|
|
Loading…
Reference in New Issue