[Lldb-commits] [lldb] 920ffab - [lldb] Use nullptr instead of NULL (NFC)

Kazu Hirata via lldb-commits lldb-commits at lists.llvm.org
Sat Aug 27 21:21:35 PDT 2022


Author: Kazu Hirata
Date: 2022-08-27T21:21:07-07:00
New Revision: 920ffab9cccfe1a5dde0368d252ed50e5dbcd6a5

URL: https://github.com/llvm/llvm-project/commit/920ffab9cccfe1a5dde0368d252ed50e5dbcd6a5
DIFF: https://github.com/llvm/llvm-project/commit/920ffab9cccfe1a5dde0368d252ed50e5dbcd6a5.diff

LOG: [lldb] Use nullptr instead of NULL (NFC)

Identified with modernize-use-nullptr.

Added: 
    

Modified: 
    lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
    lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
    lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index ae61736fbbb3..f0f5debcab8f 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -923,7 +923,7 @@ const char *PythonException::toCString() const {
 
 PythonException::PythonException(const char *caller) {
   assert(PyErr_Occurred());
-  m_exception_type = m_exception = m_traceback = m_repr_bytes = NULL;
+  m_exception_type = m_exception = m_traceback = m_repr_bytes = nullptr;
   PyErr_Fetch(&m_exception_type, &m_exception, &m_traceback);
   PyErr_NormalizeException(&m_exception_type, &m_exception, &m_traceback);
   PyErr_Clear();
@@ -951,7 +951,7 @@ void PythonException::Restore() {
   } else {
     PyErr_SetString(PyExc_Exception, toCString());
   }
-  m_exception_type = m_exception = m_traceback = NULL;
+  m_exception_type = m_exception = m_traceback = nullptr;
 }
 
 PythonException::~PythonException() {

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
index 2753847f39f8..3cbd3b5efecc 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp
@@ -40,7 +40,7 @@ static char *simple_readline(FILE *stdin, FILE *stdout, const char *prompt) {
   char *line = readline(prompt);
   if (!line) {
     char *ret = (char *)PyMem_RawMalloc(1);
-    if (ret != NULL)
+    if (ret != nullptr)
       *ret = '\0';
     return ret;
   }

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 7717f22f9788..d530936484b9 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -96,7 +96,7 @@ struct InitializePythonRAII {
     // Python's readline is incompatible with libedit being linked into lldb.
     // Provide a patched version local to the embedded interpreter.
     bool ReadlinePatched = false;
-    for (auto *p = PyImport_Inittab; p->name != NULL; p++) {
+    for (auto *p = PyImport_Inittab; p->name != nullptr; p++) {
       if (strcmp(p->name, "readline") == 0) {
         p->initfunc = initlldb_readline;
         break;


        


More information about the lldb-commits mailing list