diff options
| author | Pavel Labath <labath@google.com> | 2017-03-01 10:08:40 +0000 |
|---|---|---|
| committer | Pavel Labath <labath@google.com> | 2017-03-01 10:08:40 +0000 |
| commit | 5e336903bee9f21420c5b03d9c5552afd14376b9 (patch) | |
| tree | fa2a1aa44d05503af31ef35a747a4b6a40cd54ad /lldb/source/API | |
| parent | 9c761a36b9a93bff188109502231cc60b96894e1 (diff) | |
| download | bcm5719-llvm-5e336903bee9f21420c5b03d9c5552afd14376b9.tar.gz bcm5719-llvm-5e336903bee9f21420c5b03d9c5552afd14376b9.zip | |
Modernize Enable/DisableLogChannel interface a bit
Summary:
Use StringRef and ArrayRef where possible. This adds an accessor to the
Args class to get a view of the arguments as ArrayRef<const char *>.
Reviewers: zturner
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D30402
llvm-svn: 296592
Diffstat (limited to 'lldb/source/API')
| -rw-r--r-- | lldb/source/API/SBDebugger.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index 97e6f7b518a..d0a16042d8e 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -1120,13 +1120,22 @@ SBTypeSynthetic SBDebugger::GetSyntheticForType(SBTypeNameSpecifier type_name) { } #endif // LLDB_DISABLE_PYTHON +static llvm::ArrayRef<const char *> GetCategoryArray(const char **categories) { + if (categories == nullptr) + return {}; + size_t len = 0; + while (categories[len] != nullptr) + ++len; + return llvm::makeArrayRef(categories, len); +} + bool SBDebugger::EnableLog(const char *channel, const char **categories) { if (m_opaque_sp) { uint32_t log_options = LLDB_LOG_OPTION_PREPEND_TIMESTAMP | LLDB_LOG_OPTION_PREPEND_THREAD_NAME; StreamString errors; - return m_opaque_sp->EnableLog(channel, categories, nullptr, log_options, - errors); + return m_opaque_sp->EnableLog(channel, GetCategoryArray(categories), "", + log_options, errors); } else return false; } |

