[Lldb-commits] [lldb] r251377 - Minor cleanup of SBTypeSummary::CreateWithCallback to take an optional description argument
Enrico Granata via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 26 18:17:30 PDT 2015
Author: enrico
Date: Mon Oct 26 20:17:28 2015
New Revision: 251377
URL: http://llvm.org/viewvc/llvm-project?rev=251377&view=rev
Log:
Minor cleanup of SBTypeSummary::CreateWithCallback to take an optional description argument
Modified:
lldb/trunk/include/lldb/API/SBTypeSummary.h
lldb/trunk/source/API/SBTypeSummary.cpp
Modified: lldb/trunk/include/lldb/API/SBTypeSummary.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTypeSummary.h?rev=251377&r1=251376&r2=251377&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTypeSummary.h (original)
+++ lldb/trunk/include/lldb/API/SBTypeSummary.h Mon Oct 26 20:17:28 2015
@@ -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);
Modified: lldb/trunk/source/API/SBTypeSummary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTypeSummary.cpp?rev=251377&r1=251376&r2=251377&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTypeSummary.cpp (original)
+++ lldb/trunk/source/API/SBTypeSummary.cpp Mon Oct 26 20:17:28 2015
@@ -147,22 +147,25 @@ SBTypeSummary::CreateWithScriptCode (con
}
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) :
More information about the lldb-commits
mailing list