mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 01:58:44 +08:00
Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
llvm-svn: 263300
This commit is contained in:
@@ -11,30 +11,31 @@
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <cstring>
|
||||
#include <atomic>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Interpreter/Args.h"
|
||||
#include "lldb/Core/Log.h"
|
||||
#include "lldb/Core/StreamFile.h"
|
||||
#include <string.h>
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
|
||||
// We want to avoid global constructors where code needs to be run so here we
|
||||
// control access to our static g_log_sp by hiding it in a singleton function
|
||||
// that will construct the static g_lob_sp the first time this function is
|
||||
// called.
|
||||
|
||||
static std::atomic<bool> g_log_enabled {false};
|
||||
static Log * g_log = NULL;
|
||||
static Log * g_log = nullptr;
|
||||
|
||||
static Log *
|
||||
GetLog ()
|
||||
{
|
||||
if (!g_log_enabled)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return g_log;
|
||||
}
|
||||
|
||||
@@ -62,7 +63,7 @@ lldb_private::GetLogIfAllCategoriesSet (uint32_t mask)
|
||||
{
|
||||
uint32_t log_mask = log->GetMask().Get();
|
||||
if ((log_mask & mask) != mask)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return log;
|
||||
}
|
||||
@@ -84,7 +85,7 @@ void
|
||||
lldb_private::LogIfAnyCategoriesSet (uint32_t mask, const char *format, ...)
|
||||
{
|
||||
Log *log(GetLogIfAnyCategoriesSet (mask));
|
||||
if (log)
|
||||
if (log != nullptr)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
@@ -97,9 +98,9 @@ Log *
|
||||
lldb_private::GetLogIfAnyCategoriesSet (uint32_t mask)
|
||||
{
|
||||
Log *log(GetLog ());
|
||||
if (log && mask && (mask & log->GetMask().Get()))
|
||||
if (log != nullptr && mask && (mask & log->GetMask().Get()))
|
||||
return log;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -107,13 +108,13 @@ lldb_private::DisableLog (const char **categories, Stream *feedback_strm)
|
||||
{
|
||||
Log *log(GetLog ());
|
||||
|
||||
if (log)
|
||||
if (log != nullptr)
|
||||
{
|
||||
uint32_t flag_bits = 0;
|
||||
if (categories[0] != NULL)
|
||||
if (categories[0] != nullptr)
|
||||
{
|
||||
flag_bits = log->GetMask().Get();
|
||||
for (size_t i = 0; categories[i] != NULL; ++i)
|
||||
for (size_t i = 0; categories[i] != nullptr; ++i)
|
||||
{
|
||||
const char *arg = categories[i];
|
||||
|
||||
@@ -164,8 +165,6 @@ lldb_private::DisableLog (const char **categories, Stream *feedback_strm)
|
||||
g_log_enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Log *
|
||||
@@ -174,7 +173,7 @@ lldb_private::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, const ch
|
||||
// Try see if there already is a log - that way we can reuse its settings.
|
||||
// We could reuse the log in toto, but we don't know that the stream is the same.
|
||||
uint32_t flag_bits;
|
||||
if (g_log)
|
||||
if (g_log != nullptr)
|
||||
flag_bits = g_log->GetMask().Get();
|
||||
else
|
||||
flag_bits = 0;
|
||||
@@ -182,15 +181,15 @@ lldb_private::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, const ch
|
||||
// Now make a new log with this stream if one was provided
|
||||
if (log_stream_sp)
|
||||
{
|
||||
if (g_log)
|
||||
if (g_log != nullptr)
|
||||
g_log->SetStream(log_stream_sp);
|
||||
else
|
||||
g_log = new Log(log_stream_sp);
|
||||
}
|
||||
|
||||
if (g_log)
|
||||
if (g_log != nullptr)
|
||||
{
|
||||
for (size_t i=0; categories[i] != NULL; ++i)
|
||||
for (size_t i = 0; categories[i] != nullptr; ++i)
|
||||
{
|
||||
const char *arg = categories[i];
|
||||
|
||||
@@ -241,7 +240,6 @@ lldb_private::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, const ch
|
||||
return g_log;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
lldb_private::ListLogCategories (Stream *strm)
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
#include "llvm/ADT/Triple.h"
|
||||
|
||||
// Project includes
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/DataBufferHeap.h"
|
||||
@@ -20,11 +21,9 @@
|
||||
#include "lldb/Core/Stream.h"
|
||||
#include "lldb/Host/Endian.h"
|
||||
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
|
||||
int
|
||||
Opcode::Dump (Stream *s, uint32_t min_byte_width)
|
||||
{
|
||||
@@ -50,13 +49,11 @@ Opcode::Dump (Stream *s, uint32_t min_byte_width)
|
||||
break;
|
||||
|
||||
case Opcode::eTypeBytes:
|
||||
for (uint32_t i = 0; i < m_data.inst.length; ++i)
|
||||
{
|
||||
for (uint32_t i=0; i<m_data.inst.length; ++i)
|
||||
{
|
||||
if (i > 0)
|
||||
bytes_written += s->PutChar (' ');
|
||||
bytes_written += s->Printf ("%2.2x", m_data.inst.bytes[i]);
|
||||
}
|
||||
if (i > 0)
|
||||
bytes_written += s->PutChar (' ');
|
||||
bytes_written += s->Printf ("%2.2x", m_data.inst.bytes[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -94,7 +91,7 @@ Opcode::GetData (DataExtractor &data) const
|
||||
{
|
||||
uint32_t byte_size = GetByteSize ();
|
||||
uint8_t swap_buf[8];
|
||||
const void *buf = NULL;
|
||||
const void *buf = nullptr;
|
||||
|
||||
if (byte_size > 0)
|
||||
{
|
||||
@@ -148,7 +145,7 @@ Opcode::GetData (DataExtractor &data) const
|
||||
}
|
||||
}
|
||||
}
|
||||
if (buf)
|
||||
if (buf != nullptr)
|
||||
{
|
||||
DataBufferSP buffer_sp;
|
||||
|
||||
@@ -160,6 +157,3 @@ Opcode::GetData (DataExtractor &data) const
|
||||
data.Clear();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user