diff options
| author | Dawn Perchik <dawn@burble.org> | 2015-10-23 00:02:56 +0000 |
|---|---|---|
| committer | Dawn Perchik <dawn@burble.org> | 2015-10-23 00:02:56 +0000 |
| commit | 8826519e2af08b79944e187aadf11e7a92cbe039 (patch) | |
| tree | 3f5e38494dec6f3505d29d596bbb590268e7ec87 /lldb/source/API | |
| parent | 1e9aadba174f0d598b5a695ad0f5c0f1f8af1041 (diff) | |
| download | bcm5719-llvm-8826519e2af08b79944e187aadf11e7a92cbe039.tar.gz bcm5719-llvm-8826519e2af08b79944e187aadf11e7a92cbe039.zip | |
Summary provider for char.
This patch enables type summary for 'char' type. Given:
char c = 'h';
Before this patch, c evaluates as:
(char) $0 = 'h'
After this patch, we get:
(char) $0 = 104 'h'
This change allows the formatting of character types in MI to be removed
and replaced with that in lldb, and can be useful when evaluating
non-printable characters.
Patch from evgeny.leviant@gmail.com
Reviewed by: granata.enrico
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13657
llvm-svn: 251080
Diffstat (limited to 'lldb/source/API')
| -rw-r--r-- | lldb/source/API/SBTypeSummary.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lldb/source/API/SBTypeSummary.cpp b/lldb/source/API/SBTypeSummary.cpp index 08d8b96560a..1934f4e87f9 100644 --- a/lldb/source/API/SBTypeSummary.cpp +++ b/lldb/source/API/SBTypeSummary.cpp @@ -146,6 +146,25 @@ SBTypeSummary::CreateWithScriptCode (const char* data, uint32_t options) return SBTypeSummary(TypeSummaryImplSP(new ScriptSummaryFormat(options, "", data))); } +SBTypeSummary +SBTypeSummary::CreateWithCallback (FormatCallback cb, uint32_t options) +{ + return SBTypeSummary( + TypeSummaryImplSP( + cb ? new CXXFunctionSummaryFormat(options, + [cb] (ValueObject& valobj, Stream& stm, const TypeSummaryOptions& opt) -> bool { + BStream stream; + if (!cb(SBValue(valobj.GetSP()), SBTypeSummaryOptions(&opt), stream)) + return false; + stm.Write(stream.GetData(), stream.GetSize()); + return true; + }, + "SBTypeSummary formatter callback" + ) : nullptr + ) + ); +} + SBTypeSummary::SBTypeSummary (const lldb::SBTypeSummary &rhs) : m_opaque_sp(rhs.m_opaque_sp) { |

