diff options
| author | Enrico Granata <egranata@apple.com> | 2016-04-12 21:57:11 +0000 |
|---|---|---|
| committer | Enrico Granata <egranata@apple.com> | 2016-04-12 21:57:11 +0000 |
| commit | ade56c3ea0805a9e97ea18924fd1ca5b14917edb (patch) | |
| tree | 9e7e1e208d58f72725f84d54947ec4bcc37bbe55 /lldb/source/Commands | |
| parent | 7c7e73b52df8bae89c1c6220f4cbbf16ca45fdae (diff) | |
| download | bcm5719-llvm-ade56c3ea0805a9e97ea18924fd1ca5b14917edb.tar.gz bcm5719-llvm-ade56c3ea0805a9e97ea18924fd1ca5b14917edb.zip | |
Use the FormatEntity work for great good - parse summary strings before accepting them, and fail to add any strings that fail parsing
llvm-svn: 266138
Diffstat (limited to 'lldb/source/Commands')
| -rw-r--r-- | lldb/source/Commands/CommandObjectType.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp index 1c2bf89ac1d..a3c5353930b 100644 --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -1718,20 +1718,23 @@ CommandObjectTypeSummaryAdd::Execute_StringSummary (Args& command, CommandReturn return false; } - Error error; - - lldb::TypeSummaryImplSP entry(new StringSummaryFormat(m_options.m_flags, - format_cstr)); - - if (error.Fail()) + std::unique_ptr<StringSummaryFormat> string_format(new StringSummaryFormat(m_options.m_flags, format_cstr)); + if (!string_format) { - result.AppendError(error.AsCString()); + result.AppendError("summary creation failed"); result.SetStatus(eReturnStatusFailed); return false; } + if (string_format->m_error.Fail()) + { + result.AppendErrorWithFormat("syntax error: %s", string_format->m_error.AsCString("<unknown>")); + result.SetStatus(eReturnStatusFailed); + return false; + } + lldb::TypeSummaryImplSP entry(string_format.release()); // now I have a valid format, let's add it to every type - + Error error; for (size_t i = 0; i < argc; i++) { const char* typeA = command.GetArgumentAtIndex(i); |

