[lldb] NFC modernize codebase with modernize-use-nullptr

Summary:
NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]]

This commit is the result of modernizing the LLDB codebase by using
`nullptr` instread of `0` or `NULL`. See
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
for more information.

This is the command I ran and I to fix and format the code base:

```
run-clang-tidy.py \
	-header-filter='.*' \
	-checks='-*,modernize-use-nullptr' \
	-fix ~/dev/llvm-project/lldb/.* \
	-format \
	-style LLVM \
	-p ~/llvm-builds/debug-ninja-gcc
```

NOTE: There were also changes to `llvm/utils/unittest` but I did not
include them because I felt that maybe this library shall be updated in
isolation somehow.

NOTE: I know this is a rather large commit but it is a nobrainer in most
parts.

Reviewers: martong, espindola, shafik, #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits

Tags: #lldb, #llvm

Differential Revision: https://reviews.llvm.org/D61847

llvm-svn: 361484
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp
index 3fecb0c..369f883 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp
@@ -85,7 +85,7 @@
 
   memcpy(str, m_dump.c_str(), len);
 
-  char *end = NULL;
+  char *end = nullptr;
 
   end = strchr(str, '\n');
 
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
index 71e1307..5dc39e8 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp
@@ -34,8 +34,9 @@
 
 ASTResultSynthesizer::ASTResultSynthesizer(ASTConsumer *passthrough,
                                            bool top_level, Target &target)
-    : m_ast_context(NULL), m_passthrough(passthrough), m_passthrough_sema(NULL),
-      m_target(target), m_sema(NULL), m_top_level(top_level) {
+    : m_ast_context(nullptr), m_passthrough(passthrough),
+      m_passthrough_sema(nullptr), m_target(target), m_sema(nullptr),
+      m_top_level(top_level) {
   if (!m_passthrough)
     return;
 
@@ -311,7 +312,7 @@
                 (is_lvalue ? "lvalue" : "rvalue"), s.c_str());
   }
 
-  clang::VarDecl *result_decl = NULL;
+  clang::VarDecl *result_decl = nullptr;
 
   if (is_lvalue) {
     IdentifierInfo *result_ptr_id;
@@ -329,14 +330,14 @@
 
     QualType ptr_qual_type;
 
-    if (expr_qual_type->getAs<ObjCObjectType>() != NULL)
+    if (expr_qual_type->getAs<ObjCObjectType>() != nullptr)
       ptr_qual_type = Ctx.getObjCObjectPointerType(expr_qual_type);
     else
       ptr_qual_type = Ctx.getPointerType(expr_qual_type);
 
     result_decl =
         VarDecl::Create(Ctx, DC, SourceLocation(), SourceLocation(),
-                        result_ptr_id, ptr_qual_type, NULL, SC_Static);
+                        result_ptr_id, ptr_qual_type, nullptr, SC_Static);
 
     if (!result_decl)
       return false;
@@ -350,8 +351,9 @@
   } else {
     IdentifierInfo &result_id = Ctx.Idents.get("$__lldb_expr_result");
 
-    result_decl = VarDecl::Create(Ctx, DC, SourceLocation(), SourceLocation(),
-                                  &result_id, expr_qual_type, NULL, SC_Static);
+    result_decl =
+        VarDecl::Create(Ctx, DC, SourceLocation(), SourceLocation(), &result_id,
+                        expr_qual_type, nullptr, SC_Static);
 
     if (!result_decl)
       return false;
@@ -507,7 +509,7 @@
 }
 
 void ASTResultSynthesizer::ForgetSema() {
-  m_sema = NULL;
+  m_sema = nullptr;
 
   if (m_passthrough_sema)
     m_passthrough_sema->ForgetSema();
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp
index 1d8e693..190eaca 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTStructExtractor.cpp
@@ -29,9 +29,9 @@
 ASTStructExtractor::ASTStructExtractor(ASTConsumer *passthrough,
                                        const char *struct_name,
                                        ClangFunctionCaller &function)
-    : m_ast_context(NULL), m_passthrough(passthrough), m_passthrough_sema(NULL),
-      m_sema(NULL), m_action(NULL), m_function(function),
-      m_struct_name(struct_name) {
+    : m_ast_context(nullptr), m_passthrough(passthrough),
+      m_passthrough_sema(nullptr), m_sema(nullptr), m_action(nullptr),
+      m_function(function), m_struct_name(struct_name) {
   if (!m_passthrough)
     return;
 
@@ -57,7 +57,7 @@
   if (!body_compound_stmt)
     return; // do we have to handle this?
 
-  RecordDecl *struct_decl = NULL;
+  RecordDecl *struct_decl = nullptr;
 
   StringRef desired_name(m_struct_name);
 
@@ -177,8 +177,8 @@
 }
 
 void ASTStructExtractor::ForgetSema() {
-  m_sema = NULL;
-  m_action = NULL;
+  m_sema = nullptr;
+  m_action = nullptr;
 
   if (m_passthrough_sema)
     m_passthrough_sema->ForgetSema();
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index 9219179..632594f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -51,7 +51,7 @@
 
 ClangASTSource::ClangASTSource(const lldb::TargetSP &target)
     : m_import_in_progress(false), m_lookups_enabled(false), m_target(target),
-      m_ast_context(NULL), m_active_lexical_decls(), m_active_lookups() {
+      m_ast_context(nullptr), m_active_lexical_decls(), m_active_lookups() {
   if (!target->GetUseModernTypeLookup()) {
     m_ast_importer_sp = m_target->GetClangASTImporter();
   }
@@ -441,8 +441,8 @@
     return;
   }
 
-  Decl *original_decl = NULL;
-  ASTContext *original_ctx = NULL;
+  Decl *original_decl = nullptr;
+  ASTContext *original_ctx = nullptr;
 
   if (m_ast_importer_sp->ResolveDeclOrigin(interface_decl, &original_decl,
                                            &original_ctx)) {
@@ -475,12 +475,12 @@
   lldb::ProcessSP process(m_target->GetProcessSP());
 
   if (!process)
-    return NULL;
+    return nullptr;
 
   ObjCLanguageRuntime *language_runtime(process->GetObjCLanguageRuntime());
 
   if (!language_runtime)
-    return NULL;
+    return nullptr;
 
   ConstString class_name(interface_decl->getNameAsString().c_str());
 
@@ -488,7 +488,7 @@
       language_runtime->LookupInCompleteClassCache(class_name));
 
   if (!complete_type_sp)
-    return NULL;
+    return nullptr;
 
   TypeFromUser complete_type =
       TypeFromUser(complete_type_sp->GetFullCompilerType());
@@ -496,7 +496,7 @@
       complete_type.GetOpaqueQualType();
 
   if (!complete_opaque_type)
-    return NULL;
+    return nullptr;
 
   const clang::Type *complete_clang_type =
       QualType::getFromOpaquePtr(complete_opaque_type).getTypePtr();
@@ -504,7 +504,7 @@
       dyn_cast<ObjCInterfaceType>(complete_clang_type);
 
   if (!complete_interface_type)
-    return NULL;
+    return nullptr;
 
   ObjCInterfaceDecl *complete_iface_decl(complete_interface_type->getDecl());
 
@@ -569,8 +569,8 @@
           current_id, static_cast<const void *>(m_ast_context));
   }
 
-  Decl *original_decl = NULL;
-  ASTContext *original_ctx = NULL;
+  Decl *original_decl = nullptr;
+  ASTContext *original_ctx = nullptr;
 
   if (!m_ast_importer_sp->ResolveDeclOrigin(context_decl, &original_decl,
                                             &original_ctx))
@@ -993,9 +993,9 @@
 
 template <class D> class TaggedASTDecl {
 public:
-  TaggedASTDecl() : decl(NULL) {}
+  TaggedASTDecl() : decl(nullptr) {}
   TaggedASTDecl(D *_decl) : decl(_decl) {}
-  bool IsValid() const { return (decl != NULL); }
+  bool IsValid() const { return (decl != nullptr); }
   bool IsInvalid() const { return !IsValid(); }
   D *operator->() const { return decl; }
   D *decl;
@@ -1028,7 +1028,7 @@
 template <class D>
 DeclFromUser<D> DeclFromParser<D>::GetOrigin(ClangASTSource &source) {
   DeclFromUser<> origin_decl;
-  source.ResolveDeclOrigin(this->decl, &origin_decl.decl, NULL);
+  source.ResolveDeclOrigin(this->decl, &origin_decl.decl, nullptr);
   if (origin_decl.IsInvalid())
     return DeclFromUser<D>();
   return DeclFromUser<D>(dyn_cast<D>(origin_decl.decl));
@@ -1158,8 +1158,8 @@
     return;
 
   do {
-    Decl *original_decl = NULL;
-    ASTContext *original_ctx = NULL;
+    Decl *original_decl = nullptr;
+    ASTContext *original_ctx = nullptr;
 
     m_ast_importer_sp->ResolveDeclOrigin(interface_decl, &original_decl,
                                          &original_ctx);
@@ -2063,12 +2063,12 @@
   assert(type && "Type for variable must be valid!");
 
   if (!type.IsValid())
-    return NULL;
+    return nullptr;
 
   ClangASTContext *lldb_ast =
       llvm::dyn_cast<ClangASTContext>(type.GetTypeSystem());
   if (!lldb_ast)
-    return NULL;
+    return nullptr;
 
   IdentifierInfo *ii = m_decl_name.getAsIdentifierInfo();
 
@@ -2076,7 +2076,7 @@
 
   clang::NamedDecl *Decl = VarDecl::Create(
       *ast, const_cast<DeclContext *>(m_decl_context), SourceLocation(),
-      SourceLocation(), ii, ClangUtil::GetQualType(type), 0, SC_Static);
+      SourceLocation(), ii, ClangUtil::GetQualType(type), nullptr, SC_Static);
   m_decls.push_back(Decl);
 
   return Decl;
@@ -2087,15 +2087,15 @@
   assert(type && "Type for variable must be valid!");
 
   if (!type.IsValid())
-    return NULL;
+    return nullptr;
 
   if (m_function_types.count(type))
-    return NULL;
+    return nullptr;
 
   ClangASTContext *lldb_ast =
       llvm::dyn_cast<ClangASTContext>(type.GetTypeSystem());
   if (!lldb_ast)
-    return NULL;
+    return nullptr;
 
   m_function_types.insert(type);
 
@@ -2124,7 +2124,7 @@
 
   clang::FunctionDecl *func_decl = FunctionDecl::Create(
       *ast, context, SourceLocation(), SourceLocation(), decl_name, qual_type,
-      NULL, SC_Extern, isInlineSpecified, hasWrittenPrototype,
+      nullptr, SC_Extern, isInlineSpecified, hasWrittenPrototype,
       isConstexprSpecified);
 
   // We have to do more than just synthesize the FunctionDecl.  We have to
@@ -2143,9 +2143,10 @@
     for (ArgIndex = 0; ArgIndex < NumArgs; ++ArgIndex) {
       QualType arg_qual_type(func_proto_type->getParamType(ArgIndex));
 
-      parm_var_decls.push_back(ParmVarDecl::Create(
-          *ast, const_cast<DeclContext *>(context), SourceLocation(),
-          SourceLocation(), NULL, arg_qual_type, NULL, SC_Static, NULL));
+      parm_var_decls.push_back(
+          ParmVarDecl::Create(*ast, const_cast<DeclContext *>(context),
+                              SourceLocation(), SourceLocation(), nullptr,
+                              arg_qual_type, nullptr, SC_Static, nullptr));
     }
 
     func_decl->setParams(ArrayRef<ParmVarDecl *>(parm_var_decls));
@@ -2166,7 +2167,7 @@
       ClangASTContext::IsOperator(decl_name.getAsString().c_str(), op_kind)) {
     if (!ClangASTContext::CheckOverloadedOperatorKindParameterCount(
             false, op_kind, func_proto_type->getNumParams()))
-      return NULL;
+      return nullptr;
   }
   m_decls.push_back(func_decl);
 
@@ -2214,7 +2215,7 @@
       return (NamedDecl *)interface_decl;
     }
   }
-  return NULL;
+  return nullptr;
 }
 
 void NameSearchContext::AddLookupResult(clang::DeclContextLookupResult result) {
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
index 624c86a..7a8bacf 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
@@ -45,15 +45,15 @@
   ~ClangASTSource() override;
 
   /// Interface stubs.
-  clang::Decl *GetExternalDecl(uint32_t) override { return NULL; }
-  clang::Stmt *GetExternalDeclStmt(uint64_t) override { return NULL; }
+  clang::Decl *GetExternalDecl(uint32_t) override { return nullptr; }
+  clang::Stmt *GetExternalDeclStmt(uint64_t) override { return nullptr; }
   clang::Selector GetExternalSelector(uint32_t) override {
     return clang::Selector();
   }
   uint32_t GetNumExternalSelectors() override { return 0; }
   clang::CXXBaseSpecifier *
   GetExternalCXXBaseSpecifiers(uint64_t Offset) override {
-    return NULL;
+    return nullptr;
   }
   void MaterializeVisibleDecls(const clang::DeclContext *DC) { return; }
 
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 83cbe51..496d5b4 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -367,7 +367,7 @@
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
   ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx;
   Target *target = exe_ctx.GetTargetPtr();
-  if (target == NULL)
+  if (target == nullptr)
     return false;
 
   ClangASTContext *context(target->GetScratchClangASTContext());
@@ -951,7 +951,7 @@
 
       // Clang is looking for the type of "this"
 
-      if (frame == NULL)
+      if (frame == nullptr)
         return;
 
       // Find the block that defines the function represented by "sym_ctx"
@@ -1277,7 +1277,8 @@
       }
     }
     if (target) {
-      var = FindGlobalVariable(*target, module_sp, name, &namespace_decl, NULL);
+      var = FindGlobalVariable(*target, module_sp, name, &namespace_decl,
+                               nullptr);
 
       if (var) {
         valobj = ValueObjectVariable::Create(target, var);
@@ -1434,8 +1435,8 @@
     }
 
     if (sc_list.GetSize()) {
-      Symbol *extern_symbol = NULL;
-      Symbol *non_extern_symbol = NULL;
+      Symbol *extern_symbol = nullptr;
+      Symbol *non_extern_symbol = nullptr;
 
       for (uint32_t index = 0, num_indices = sc_list.GetSize();
            index < num_indices; ++index) {
@@ -1452,13 +1453,13 @@
           if (decl_ctx.IsClassMethod(nullptr, nullptr, nullptr))
             continue;
 
-          AddOneFunction(context, sym_ctx.function, NULL, current_id);
+          AddOneFunction(context, sym_ctx.function, nullptr, current_id);
           context.m_found.function_with_type_info = true;
           context.m_found.function = true;
         } else if (sym_ctx.symbol) {
           if (sym_ctx.symbol->GetType() == eSymbolTypeReExported && target) {
             sym_ctx.symbol = sym_ctx.symbol->ResolveReExportedSymbol(*target);
-            if (sym_ctx.symbol == NULL)
+            if (sym_ctx.symbol == nullptr)
               continue;
           }
 
@@ -1484,10 +1485,10 @@
 
       if (!context.m_found.function_with_type_info) {
         if (extern_symbol) {
-          AddOneFunction(context, NULL, extern_symbol, current_id);
+          AddOneFunction(context, nullptr, extern_symbol, current_id);
           context.m_found.function = true;
         } else if (non_extern_symbol) {
-          AddOneFunction(context, NULL, non_extern_symbol, current_id);
+          AddOneFunction(context, nullptr, non_extern_symbol, current_id);
           context.m_found.function = true;
         }
       }
@@ -1723,7 +1724,7 @@
 
   bool is_reference = pt.IsReferenceType();
 
-  NamedDecl *var_decl = NULL;
+  NamedDecl *var_decl = nullptr;
   if (is_reference)
     var_decl = context.AddVarDecl(pt);
   else
@@ -1740,7 +1741,7 @@
       entity->GetParserVars(GetParserID());
   parser_vars->m_parser_type = pt;
   parser_vars->m_named_decl = var_decl;
-  parser_vars->m_llvm_value = NULL;
+  parser_vars->m_llvm_value = nullptr;
   parser_vars->m_lldb_value = var_location;
   parser_vars->m_lldb_var = var;
 
@@ -1783,7 +1784,7 @@
           ->GetParserVars(GetParserID());
   parser_vars->m_parser_type = parser_type;
   parser_vars->m_named_decl = var_decl;
-  parser_vars->m_llvm_value = NULL;
+  parser_vars->m_llvm_value = nullptr;
   parser_vars->m_lldb_value.Clear();
 
   if (log) {
@@ -1802,7 +1803,7 @@
 
   Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();
 
-  if (target == NULL)
+  if (target == nullptr)
     return;
 
   ASTContext *scratch_ast_context =
@@ -1841,7 +1842,7 @@
 
   parser_vars->m_parser_type = parser_type;
   parser_vars->m_named_decl = var_decl;
-  parser_vars->m_llvm_value = NULL;
+  parser_vars->m_llvm_value = nullptr;
   parser_vars->m_lldb_sym = &symbol;
 
   if (log) {
@@ -1889,7 +1890,7 @@
           var_type.getAsOpaquePtr(),
           ClangASTContext::GetASTContext(&var_decl->getASTContext()));
 
-      lldb::opaque_compiler_type_t copied_type = 0;
+      lldb::opaque_compiler_type_t copied_type = nullptr;
       if (m_ast_importer_sp) {
         copied_type = m_ast_importer_sp->CopyType(
             scratch_ast_context->getASTContext(), &var_decl->getASTContext(),
@@ -1962,7 +1963,7 @@
       entity->GetParserVars(GetParserID());
   parser_vars->m_parser_type = parser_clang_type;
   parser_vars->m_named_decl = var_decl;
-  parser_vars->m_llvm_value = NULL;
+  parser_vars->m_llvm_value = nullptr;
   parser_vars->m_lldb_value.Clear();
   entity->m_flags |= ClangExpressionVariable::EVBareRegister;
 
@@ -1981,7 +1982,7 @@
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
 
-  NamedDecl *function_decl = NULL;
+  NamedDecl *function_decl = nullptr;
   Address fun_address;
   CompilerType function_clang_type;
 
@@ -2141,7 +2142,7 @@
   }
 
   parser_vars->m_named_decl = function_decl;
-  parser_vars->m_llvm_value = NULL;
+  parser_vars->m_llvm_value = nullptr;
 
   if (log) {
     std::string function_str =
@@ -2194,7 +2195,7 @@
     CXXMethodDecl *method_decl =
         ClangASTContext::GetASTContext(m_ast_context)
             ->AddMethodToCXXRecordType(
-                copied_clang_type.GetOpaqueQualType(), "$__lldb_expr", NULL,
+                copied_clang_type.GetOpaqueQualType(), "$__lldb_expr", nullptr,
                 method_type, lldb::eAccessPublic, is_virtual, is_static,
                 is_inline, is_explicit, is_attr_used, is_artificial);
 
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
index a7e2ced..03b73e6 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -242,9 +242,8 @@
   /// \return
   ///     Valid load address for the symbol
   lldb::addr_t GetSymbolAddress(Target &target, Process *process,
-                                ConstString name,
-                                lldb::SymbolType symbol_type,
-                                Module *module = NULL);
+                                ConstString name, lldb::SymbolType symbol_type,
+                                Module *module = nullptr);
 
   lldb::addr_t GetSymbolAddress(ConstString name,
                                 lldb::SymbolType symbol_type);
@@ -331,7 +330,7 @@
         return m_exe_ctx.GetTargetPtr();
       else if (m_sym_ctx.target_sp)
         m_sym_ctx.target_sp.get();
-      return NULL;
+      return nullptr;
     }
 
     ExecutionContext m_exe_ctx; ///< The execution context to use when parsing.
@@ -368,7 +367,7 @@
   struct StructVars {
     StructVars()
         : m_struct_alignment(0), m_struct_size(0), m_struct_laid_out(false),
-          m_result_name(), m_object_pointer_type(NULL, NULL) {}
+          m_result_name(), m_object_pointer_type(nullptr, nullptr) {}
 
     lldb::offset_t
         m_struct_alignment; ///< The alignment of the struct in bytes.
@@ -421,7 +420,7 @@
   lldb::VariableSP FindGlobalVariable(Target &target, lldb::ModuleSP &module,
                                       ConstString name,
                                       CompilerDeclContext *namespace_decl,
-                                      TypeFromUser *type = NULL);
+                                      TypeFromUser *type = nullptr);
 
   /// Get the value of a variable in a given execution context and return the
   /// associated Types if needed.
@@ -449,8 +448,8 @@
   ///     Return true if the value was successfully filled in.
   bool GetVariableValue(lldb::VariableSP &var,
                         lldb_private::Value &var_location,
-                        TypeFromUser *found_type = NULL,
-                        TypeFromParser *parser_type = NULL);
+                        TypeFromUser *found_type = nullptr,
+                        TypeFromParser *parser_type = nullptr);
 
   /// Use the NameSearchContext to generate a Decl for the given LLDB
   /// Variable, and put it in the Tuple list.
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index 0659851..9fd9fe9 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -1229,7 +1229,7 @@
       type_system_helper->DeclMap(); // result can be NULL
 
   if (decl_map) {
-    Stream *error_stream = NULL;
+    Stream *error_stream = nullptr;
     Target *target = exe_ctx.GetTargetPtr();
     error_stream = target->GetDebugger().GetErrorFile().get();
 
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h
index bb5e6e7..eb7f74f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h
@@ -117,8 +117,8 @@
   class ParserVars {
   public:
     ParserVars()
-        : m_parser_type(), m_named_decl(NULL), m_llvm_value(NULL),
-          m_lldb_value(), m_lldb_var(), m_lldb_sym(NULL) {}
+        : m_parser_type(), m_named_decl(nullptr), m_llvm_value(nullptr),
+          m_lldb_value(), m_lldb_var(), m_lldb_sym(nullptr) {}
 
     TypeFromParser
         m_parser_type; ///< The type of the variable according to the parser
@@ -152,7 +152,7 @@
     ParserVarMap::iterator i = m_parser_vars.find(parser_id);
 
     if (i == m_parser_vars.end())
-      return NULL;
+      return nullptr;
     else
       return &i->second;
   }
@@ -186,7 +186,7 @@
     JITVarMap::iterator i = m_jit_vars.find(parser_id);
 
     if (i == m_jit_vars.end())
-      return NULL;
+      return nullptr;
     else
       return &i->second;
   }
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
index bdcead2..24f6f2e 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
@@ -72,7 +72,7 @@
 
     /// Return the object that the parser should use when resolving external
     /// values.  May be NULL if everything should be self-contained.
-    ClangExpressionDeclMap *DeclMap() override { return NULL; }
+    ClangExpressionDeclMap *DeclMap() override { return nullptr; }
 
     /// Return the object that the parser should allow to access ASTs. May be
     /// NULL if the ASTs do not need to be transformed.
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
index e77ba86..912c9ef 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
@@ -48,7 +48,7 @@
     return;
   name++;
 
-  if (strtoul(name, NULL, 0) == m_next_persistent_variable_id - 1)
+  if (strtoul(name, nullptr, 0) == m_next_persistent_variable_id - 1)
     m_next_persistent_variable_id--;
 }
 
@@ -72,7 +72,7 @@
       m_persistent_decls.find(name.GetCString());
 
   if (i == m_persistent_decls.end())
-    return NULL;
+    return nullptr;
   else
     return i->second;
 }
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
index 9fcf2d4..2dae5b7 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -102,7 +102,7 @@
   }
 
   StackFrame *frame = exe_ctx.GetFramePtr();
-  if (frame == NULL) {
+  if (frame == nullptr) {
     if (log)
       log->Printf("  [CUE::SC] Null stack frame");
     return;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
index 684cffd..5eec224 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -90,7 +90,7 @@
 
   ResetDeclMap(exe_ctx, keep_result_in_memory);
 
-  if (!DeclMap()->WillParse(exe_ctx, NULL)) {
+  if (!DeclMap()->WillParse(exe_ctx, nullptr)) {
     diagnostic_manager.PutString(
         eDiagnosticSeverityError,
         "current process state is unsuitable for expression parsing");
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
index 9c92805..f083b92 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
@@ -60,7 +60,7 @@
 
 static llvm::Value *FindEntryInstruction(llvm::Function *function) {
   if (function->empty())
-    return NULL;
+    return nullptr;
 
   return function->getEntryBlock().getFirstNonPHIOrDbg();
 }
@@ -71,11 +71,12 @@
                          lldb_private::Stream &error_stream,
                          const char *func_name)
     : ModulePass(ID), m_resolve_vars(resolve_vars), m_func_name(func_name),
-      m_module(NULL), m_decl_map(decl_map), m_CFStringCreateWithBytes(NULL),
-      m_sel_registerName(NULL), m_objc_getClass(NULL), m_intptr_ty(NULL),
-      m_error_stream(error_stream),
-      m_execution_unit(execution_unit), m_result_store(NULL),
-      m_result_is_pointer(false), m_reloc_placeholder(NULL),
+      m_module(nullptr), m_decl_map(decl_map),
+      m_CFStringCreateWithBytes(nullptr), m_sel_registerName(nullptr),
+      m_objc_getClass(nullptr), m_intptr_ty(nullptr),
+      m_error_stream(error_stream), m_execution_unit(execution_unit),
+      m_result_store(nullptr), m_result_is_pointer(false),
+      m_reloc_placeholder(nullptr),
       m_entry_instruction_finder(FindEntryInstruction) {}
 
 /* Handy utility functions used at several places in the code */
@@ -116,7 +117,7 @@
       module->getNamedMetadata("clang.global.decl.ptrs");
 
   if (!named_metadata)
-    return NULL;
+    return nullptr;
 
   unsigned num_nodes = named_metadata->getNumOperands();
   unsigned node_index;
@@ -125,7 +126,7 @@
     llvm::MDNode *metadata_node =
         dyn_cast<llvm::MDNode>(named_metadata->getOperand(node_index));
     if (!metadata_node)
-      return NULL;
+      return nullptr;
 
     if (metadata_node->getNumOperands() != 2)
       continue;
@@ -138,14 +139,14 @@
         mdconst::dyn_extract<ConstantInt>(metadata_node->getOperand(1));
 
     if (!constant_int)
-      return NULL;
+      return nullptr;
 
     uintptr_t ptr = constant_int->getZExtValue();
 
     return reinterpret_cast<clang::NamedDecl *>(ptr);
   }
 
-  return NULL;
+  return nullptr;
 }
 
 clang::NamedDecl *IRForTarget::DeclForGlobal(GlobalValue *global_val) {
@@ -164,7 +165,7 @@
   ValueSymbolTable &value_symbol_table = m_module->getValueSymbolTable();
 
   std::string result_name_str;
-  const char *result_name = NULL;
+  const char *result_name = nullptr;
 
   for (ValueSymbolTable::iterator vi = value_symbol_table.begin(),
                                   ve = value_symbol_table.end();
@@ -342,8 +343,8 @@
 
   GlobalVariable *new_result_global = new GlobalVariable(
       (*m_module), result_global->getType()->getElementType(),
-      false,                              /* not constant */
-      GlobalValue::ExternalLinkage, NULL, /* no initializer */
+      false,                                 /* not constant */
+      GlobalValue::ExternalLinkage, nullptr, /* no initializer */
       m_result_name.GetCString());
 
   // It's too late in compilation to create a new VarDecl for this, but we
@@ -488,7 +489,7 @@
         CFSCWB_ty, ConstantExpr::getIntToPtr(CFSCWB_addr_int, CFSCWB_ptr_ty)};
   }
 
-  ConstantDataSequential *string_array = NULL;
+  ConstantDataSequential *string_array = nullptr;
 
   if (cstr)
     string_array = dyn_cast<ConstantDataSequential>(cstr->getInitializer());
@@ -733,7 +734,7 @@
       }
 
       if (!cstr_array)
-        cstr_global = NULL;
+        cstr_global = nullptr;
 
       if (!RewriteObjCConstString(nsstring_global, cstr_global)) {
         if (log)
@@ -1149,8 +1150,8 @@
     return false;
 
   GlobalVariable *persistent_global = new GlobalVariable(
-      (*m_module), alloc->getType(), false, /* not constant */
-      GlobalValue::ExternalLinkage, NULL,   /* no initializer */
+      (*m_module), alloc->getType(), false,  /* not constant */
+      GlobalValue::ExternalLinkage, nullptr, /* no initializer */
       alloc->getName().str());
 
   // What we're going to do here is make believe this was a regular old
@@ -1346,13 +1347,13 @@
     std::string name(named_decl->getName().str());
 
     clang::ValueDecl *value_decl = dyn_cast<clang::ValueDecl>(named_decl);
-    if (value_decl == NULL)
+    if (value_decl == nullptr)
       return false;
 
     lldb_private::CompilerType compiler_type(&value_decl->getASTContext(),
                                              value_decl->getType());
 
-    const Type *value_type = NULL;
+    const Type *value_type = nullptr;
 
     if (name[0] == '$') {
       // The $__lldb_expr_result name indicates the return value has allocated
@@ -1630,12 +1631,12 @@
 }
 
 static bool isGuardVariableRef(Value *V) {
-  Constant *Old = NULL;
+  Constant *Old = nullptr;
 
   if (!(Old = dyn_cast<Constant>(V)))
     return false;
 
-  ConstantExpr *CE = NULL;
+  ConstantExpr *CE = nullptr;
 
   if ((CE = dyn_cast<ConstantExpr>(V))) {
     if (CE->getOpcode() != Instruction::BitCast)
@@ -1930,8 +1931,8 @@
   }
 
   for (element_index = 0; element_index < num_elements; ++element_index) {
-    const clang::NamedDecl *decl = NULL;
-    Value *value = NULL;
+    const clang::NamedDecl *decl = nullptr;
+    Value *value = nullptr;
     lldb::offset_t offset;
     lldb_private::ConstString name;
 
@@ -2051,7 +2052,7 @@
     std::string s;
     raw_string_ostream oss(s);
 
-    m_module->print(oss, NULL);
+    m_module->print(oss, nullptr);
 
     oss.flush();
 
@@ -2088,7 +2089,7 @@
   m_reloc_placeholder = new llvm::GlobalVariable(
       (*m_module), int8_ty, false /* IsConstant */,
       GlobalVariable::InternalLinkage, Constant::getNullValue(int8_ty),
-      "reloc_placeholder", NULL /* InsertBefore */,
+      "reloc_placeholder", nullptr /* InsertBefore */,
       GlobalVariable::NotThreadLocal /* ThreadLocal */, 0 /* AddressSpace */);
 
   ////////////////////////////////////////////////////////////
@@ -2110,7 +2111,7 @@
     std::string s;
     raw_string_ostream oss(s);
 
-    m_module->print(oss, NULL);
+    m_module->print(oss, nullptr);
 
     oss.flush();
 
@@ -2245,7 +2246,7 @@
     std::string s;
     raw_string_ostream oss(s);
 
-    m_module->print(oss, NULL);
+    m_module->print(oss, nullptr);
 
     oss.flush();