[Logging] Replace Log::Printf with LLDB_LOG macro (NFC)

This patch replaces explicit calls to log::Printf with the new LLDB_LOGF
macro. The macro is similar to LLDB_LOG but supports printf-style format
strings, instead of formatv-style format strings.

So instead of writing:

  if (log)
    log->Printf("%s\n", str);

You'd write:

  LLDB_LOG(log, "%s\n", str);

This change was done mechanically with the command below. I replaced the
spurious if-checks with vim, since I know how to do multi-line
replacements with it.

  find . -type f -name '*.cpp' -exec \
  sed -i '' -E 's/log->Printf\(/LLDB_LOGF\(log, /g' "{}" +

Differential revision: https://reviews.llvm.org/D65128

llvm-svn: 366936
diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
index 12fad7f..ef1ea9b 100644
--- a/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
+++ b/lldb/source/Plugins/SystemRuntime/MacOSX/AppleGetPendingItemsHandler.cpp
@@ -154,24 +154,23 @@
                 g_get_pending_items_function_code, eLanguageTypeObjC,
                 g_get_pending_items_function_name, error));
         if (error.Fail()) {
-          if (log)
-            log->Printf("Failed to get UtilityFunction for pending-items "
-                        "introspection: %s.",
-                        error.AsCString());
+          LLDB_LOGF(log,
+                    "Failed to get UtilityFunction for pending-items "
+                    "introspection: %s.",
+                    error.AsCString());
           return args_addr;
         }
 
         if (!m_get_pending_items_impl_code->Install(diagnostics, exe_ctx)) {
           if (log) {
-            log->Printf("Failed to install pending-items introspection.");
+            LLDB_LOGF(log, "Failed to install pending-items introspection.");
             diagnostics.Dump(log);
           }
           m_get_pending_items_impl_code.reset();
           return args_addr;
         }
       } else {
-        if (log)
-          log->Printf("No pending-items introspection code found.");
+        LLDB_LOGF(log, "No pending-items introspection code found.");
         return LLDB_INVALID_ADDRESS;
       }
 
@@ -186,10 +185,10 @@
               get_pending_items_return_type, get_pending_items_arglist,
               thread_sp, error);
       if (error.Fail() || get_pending_items_caller == nullptr) {
-        if (log)
-          log->Printf("Failed to install pending-items introspection function "
-                      "caller: %s.",
-                      error.AsCString());
+        LLDB_LOGF(log,
+                  "Failed to install pending-items introspection function "
+                  "caller: %s.",
+                  error.AsCString());
         m_get_pending_items_impl_code.reset();
         return args_addr;
       }
@@ -199,8 +198,7 @@
   diagnostics.Clear();
 
   if (get_pending_items_caller == nullptr) {
-    if (log)
-      log->Printf("Failed to get get_pending_items_caller.");
+    LLDB_LOGF(log, "Failed to get get_pending_items_caller.");
     return LLDB_INVALID_ADDRESS;
   }
 
@@ -212,7 +210,7 @@
   if (!get_pending_items_caller->WriteFunctionArguments(
           exe_ctx, args_addr, get_pending_items_arglist, diagnostics)) {
     if (log) {
-      log->Printf("Error writing pending-items function arguments.");
+      LLDB_LOGF(log, "Error writing pending-items function arguments.");
       diagnostics.Dump(log);
     }
 
@@ -241,9 +239,8 @@
   error.Clear();
 
   if (!thread.SafeToCallFunctions()) {
-    if (log)
-      log->Printf("Not safe to call functions on thread 0x%" PRIx64,
-                  thread.GetID());
+    LLDB_LOGF(log, "Not safe to call functions on thread 0x%" PRIx64,
+              thread.GetID());
     error.SetErrorString("Not safe to call functions on this thread.");
     return return_value;
   }
@@ -303,9 +300,8 @@
     addr_t bufaddr = process_sp->AllocateMemory(
         32, ePermissionsReadable | ePermissionsWritable, error);
     if (!error.Success() || bufaddr == LLDB_INVALID_ADDRESS) {
-      if (log)
-        log->Printf("Failed to allocate memory for return buffer for get "
-                    "current queues func call");
+      LLDB_LOGF(log, "Failed to allocate memory for return buffer for get "
+                     "current queues func call");
       return return_value;
     }
     m_get_pending_items_return_buffer_addr = bufaddr;
@@ -358,11 +354,11 @@
   func_call_ret = get_pending_items_caller->ExecuteFunction(
       exe_ctx, &args_addr, options, diagnostics, results);
   if (func_call_ret != eExpressionCompleted || !error.Success()) {
-    if (log)
-      log->Printf("Unable to call "
-                  "__introspection_dispatch_queue_get_pending_items(), got "
-                  "ExpressionResults %d, error contains %s",
-                  func_call_ret, error.AsCString(""));
+    LLDB_LOGF(log,
+              "Unable to call "
+              "__introspection_dispatch_queue_get_pending_items(), got "
+              "ExpressionResults %d, error contains %s",
+              func_call_ret, error.AsCString(""));
     error.SetErrorString("Unable to call "
                          "__introspection_dispatch_queue_get_pending_items() "
                          "for list of queues");
@@ -392,14 +388,14 @@
     return return_value;
   }
 
-  if (log)
-    log->Printf("AppleGetPendingItemsHandler called "
-                "__introspection_dispatch_queue_get_pending_items "
-                "(page_to_free == 0x%" PRIx64 ", size = %" PRId64
-                "), returned page is at 0x%" PRIx64 ", size %" PRId64
-                ", count = %" PRId64,
-                page_to_free, page_to_free_size, return_value.items_buffer_ptr,
-                return_value.items_buffer_size, return_value.count);
+  LLDB_LOGF(log,
+            "AppleGetPendingItemsHandler called "
+            "__introspection_dispatch_queue_get_pending_items "
+            "(page_to_free == 0x%" PRIx64 ", size = %" PRId64
+            "), returned page is at 0x%" PRIx64 ", size %" PRId64
+            ", count = %" PRId64,
+            page_to_free, page_to_free_size, return_value.items_buffer_ptr,
+            return_value.items_buffer_size, return_value.count);
 
   return return_value;
 }