diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-07-23 17:03:37 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-07-23 17:03:37 +0000 |
commit | eaedc5ef8f5b4bac850510dad6fbd0199cbc0d35 (patch) | |
tree | 423975bcf2c19d7bfac13983d78f6078353306c0 | |
parent | e72321f38e34b1e415398b8347e865e2cec0e4a6 (diff) | |
download | bcm5719-llvm-eaedc5ef8f5b4bac850510dad6fbd0199cbc0d35.tar.gz bcm5719-llvm-eaedc5ef8f5b4bac850510dad6fbd0199cbc0d35.zip |
[Logging] Fix format strings
Change format strings to use the `{}` syntax instead of the printf
syntax when using LLDB_LOG.
llvm-svn: 366824
-rw-r--r-- | lldb/source/Core/Communication.cpp | 20 | ||||
-rw-r--r-- | lldb/source/Target/Target.cpp | 14 |
2 files changed, 16 insertions, 18 deletions
diff --git a/lldb/source/Core/Communication.cpp b/lldb/source/Core/Communication.cpp index 9ec2b9be356..effa9ed1ead 100644 --- a/lldb/source/Core/Communication.cpp +++ b/lldb/source/Core/Communication.cpp @@ -49,7 +49,7 @@ Communication::Communication(const char *name) LLDB_LOG(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_COMMUNICATION), - "%p Communication::Communication (name = %s)", this, name); + "{0} Communication::Communication (name = {1})", this, name); SetEventName(eBroadcastBitDisconnected, "disconnected"); SetEventName(eBroadcastBitReadThreadGotBytes, "got bytes"); @@ -64,7 +64,7 @@ Communication::Communication(const char *name) Communication::~Communication() { LLDB_LOG(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_OBJECT | LIBLLDB_LOG_COMMUNICATION), - "%p Communication::~Communication (name = %s)", this, + "{0} Communication::~Communication (name = {1})", this, GetBroadcasterName().AsCString()); Clear(); } @@ -79,7 +79,7 @@ ConnectionStatus Communication::Connect(const char *url, Status *error_ptr) { Clear(); LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), - "%p Communication::Connect (url = %s)", this, url); + "{0} Communication::Connect (url = {1})", this, url); lldb::ConnectionSP connection_sp(m_connection_sp); if (connection_sp) @@ -91,7 +91,7 @@ ConnectionStatus Communication::Connect(const char *url, Status *error_ptr) { ConnectionStatus Communication::Disconnect(Status *error_ptr) { LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), - "%p Communication::Disconnect ()", this); + "{0} Communication::Disconnect ()", this); lldb::ConnectionSP connection_sp(m_connection_sp); if (connection_sp) { @@ -174,8 +174,8 @@ size_t Communication::Write(const void *src, size_t src_len, std::lock_guard<std::mutex> guard(m_write_mutex); LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), - "%p Communication::Write (src = %p, src_len = %" PRIu64 - ") connection = %p", + "{0} Communication::Write (src = {1}, src_len = %" PRIu64 + ") connection = {2}", this, src, (uint64_t)src_len, connection_sp.get()); if (connection_sp) @@ -195,7 +195,7 @@ bool Communication::StartReadThread(Status *error_ptr) { return true; LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), - "%p Communication::StartReadThread ()", this); + "{0} Communication::StartReadThread ()", this); char thread_name[1024]; snprintf(thread_name, sizeof(thread_name), "<lldb.comm.%s>", @@ -228,7 +228,7 @@ bool Communication::StopReadThread(Status *error_ptr) { return true; LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), - "%p Communication::StopReadThread ()", this); + "{0} Communication::StopReadThread ()", this); m_read_thread_enabled = false; @@ -270,8 +270,8 @@ void Communication::AppendBytesToCache(const uint8_t *bytes, size_t len, bool broadcast, ConnectionStatus status) { LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_COMMUNICATION), - "%p Communication::AppendBytesToCache (src = %p, src_len = %" PRIu64 - ", broadcast = %i)", + "{0} Communication::AppendBytesToCache (src = {1}, src_len = {2}, " + "broadcast = {3})", this, bytes, (uint64_t)len, broadcast); if ((bytes == nullptr || len == 0) && (status != lldb::eConnectionStatusEndOfFile)) diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 71819a98596..ee48f2b6b3e 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -106,12 +106,11 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, CheckInWithManager(); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); - if (log) - log->Printf("%p Target::Target()", static_cast<void *>(this)); + LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT), + "{0} Target::Target()", static_cast<void *>(this)); if (target_arch.IsValid()) { LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET), - "Target::Target created with architecture %s (%s)", + "Target::Target created with architecture {0} ({1})", target_arch.GetArchitectureName(), target_arch.GetTriple().getTriple().c_str()); } @@ -119,8 +118,7 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, Target::~Target() { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT)); - if (log) - log->Printf("%p Target::~Target()", static_cast<void *>(this)); + LLDB_LOG(log, "{0} Target::~Target()", static_cast<void *>(this)); DeleteCurrentProcess(); } @@ -2321,8 +2319,8 @@ void Target::SetDefaultArchitecture(const ArchSpec &arch) { if (properties_sp) { LLDB_LOG(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET), "Target::SetDefaultArchitecture setting target's " - "default architecture to %s (%s)", - arch.GetArchitectureName(), arch.GetTriple().getTriple().c_str()); + "default architecture to {0} ({1})", + arch.GetArchitectureName(), arch.GetTriple().getTriple()); return properties_sp->SetDefaultArchitecture(arch); } } |