Switch NULL to C++11 nullptr in source/Symbol and source/Utility

Patch by Robert Matusewicz

llvm-svn: 206713
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 9c69d94..7a847b4 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -276,9 +276,9 @@
     m_identifier_table_ap(),
     m_selector_table_ap(),
     m_builtins_ap(),
-    m_callback_tag_decl (NULL),
-    m_callback_objc_decl (NULL),
-    m_callback_baton (NULL),
+    m_callback_tag_decl (nullptr),
+    m_callback_objc_decl (nullptr),
+    m_callback_baton (nullptr),
     m_pointer_byte_size (0)
 
 {
@@ -342,7 +342,7 @@
 {
     ASTContext *ast = getASTContext();
     if (ast)
-        return ast->getExternalSource () != NULL;
+        return ast->getExternalSource () != nullptr;
     return false;
 }
 
@@ -377,7 +377,7 @@
 ASTContext *
 ClangASTContext::getASTContext()
 {
-    if (m_ast_ap.get() == NULL)
+    if (m_ast_ap.get() == nullptr)
     {
         m_ast_ap.reset(new ASTContext (*getLanguageOptions(),
                                        *getSourceManager(),
@@ -401,7 +401,7 @@
 Builtin::Context *
 ClangASTContext::getBuiltinContext()
 {
-    if (m_builtins_ap.get() == NULL)
+    if (m_builtins_ap.get() == nullptr)
         m_builtins_ap.reset (new Builtin::Context());
     return m_builtins_ap.get();
 }
@@ -409,15 +409,15 @@
 IdentifierTable *
 ClangASTContext::getIdentifierTable()
 {
-    if (m_identifier_table_ap.get() == NULL)
-        m_identifier_table_ap.reset(new IdentifierTable (*ClangASTContext::getLanguageOptions(), NULL));
+    if (m_identifier_table_ap.get() == nullptr)
+        m_identifier_table_ap.reset(new IdentifierTable (*ClangASTContext::getLanguageOptions(), nullptr));
     return m_identifier_table_ap.get();
 }
 
 LangOptions *
 ClangASTContext::getLanguageOptions()
 {
-    if (m_language_options_ap.get() == NULL)
+    if (m_language_options_ap.get() == nullptr)
     {
         m_language_options_ap.reset(new LangOptions());
         ParseLangArgs(*m_language_options_ap, IK_ObjCXX);
@@ -429,7 +429,7 @@
 SelectorTable *
 ClangASTContext::getSelectorTable()
 {
-    if (m_selector_table_ap.get() == NULL)
+    if (m_selector_table_ap.get() == nullptr)
         m_selector_table_ap.reset (new SelectorTable());
     return m_selector_table_ap.get();
 }
@@ -437,7 +437,7 @@
 clang::FileManager *
 ClangASTContext::getFileManager()
 {
-    if (m_file_manager_ap.get() == NULL)
+    if (m_file_manager_ap.get() == nullptr)
     {
         clang::FileSystemOptions file_system_options;
         m_file_manager_ap.reset(new clang::FileManager(file_system_options));
@@ -448,7 +448,7 @@
 clang::SourceManager *
 ClangASTContext::getSourceManager()
 {
-    if (m_source_manager_ap.get() == NULL)
+    if (m_source_manager_ap.get() == nullptr)
         m_source_manager_ap.reset(new clang::SourceManager(*getDiagnosticsEngine(), *getFileManager()));
     return m_source_manager_ap.get();
 }
@@ -456,7 +456,7 @@
 clang::DiagnosticsEngine *
 ClangASTContext::getDiagnosticsEngine()
 {
-    if (m_diagnostics_engine_ap.get() == NULL)
+    if (m_diagnostics_engine_ap.get() == nullptr)
     {
         llvm::IntrusiveRefCntPtr<DiagnosticIDs> diag_id_sp(new DiagnosticIDs());
         m_diagnostics_engine_ap.reset(new DiagnosticsEngine(diag_id_sp, new DiagnosticOptions()));
@@ -494,7 +494,7 @@
 DiagnosticConsumer *
 ClangASTContext::getDiagnosticConsumer()
 {
-    if (m_diagnostic_consumer_ap.get() == NULL)
+    if (m_diagnostic_consumer_ap.get() == nullptr)
         m_diagnostic_consumer_ap.reset(new NullDiagnosticConsumer);
     
     return m_diagnostic_consumer_ap.get();
@@ -503,11 +503,11 @@
 TargetOptions *
 ClangASTContext::getTargetOptions()
 {
-    if (m_target_options_rp.getPtr() == NULL && !m_target_triple.empty())
+    if (m_target_options_rp.getPtr() == nullptr && !m_target_triple.empty())
     {
         m_target_options_rp.reset ();
         m_target_options_rp = new TargetOptions();
-        if (m_target_options_rp.getPtr() != NULL)
+        if (m_target_options_rp.getPtr() != nullptr)
             m_target_options_rp->Triple = m_target_triple;
     }
     return m_target_options_rp.getPtr();
@@ -518,7 +518,7 @@
 ClangASTContext::getTargetInfo()
 {
     // target_triple should be something like "x86_64-apple-macosx"
-    if (m_target_info_ap.get() == NULL && !m_target_triple.empty())
+    if (m_target_info_ap.get() == nullptr && !m_target_triple.empty())
         m_target_info_ap.reset (TargetInfo::CreateTargetInfo(*getDiagnosticsEngine(), getTargetOptions()));
     return m_target_info_ap.get();
 }
@@ -696,7 +696,7 @@
 {
     if (ast)
     {
-        clang_type_t clang_type = NULL;
+        clang_type_t clang_type = nullptr;
         
         switch (basic_type)
         {
@@ -811,7 +811,7 @@
     ASTContext *ast = getASTContext();
     
 #define streq(a,b) strcmp(a,b) == 0
-    assert (ast != NULL);
+    assert (ast != nullptr);
     if (ast)
     {
         switch (dw_ate)
@@ -1134,9 +1134,9 @@
                                    ClangASTMetadata *metadata)
 {
     ASTContext *ast = getASTContext();
-    assert (ast != NULL);
+    assert (ast != nullptr);
      
-    if (decl_ctx == NULL)
+    if (decl_ctx == nullptr)
         decl_ctx = ast->getTranslationUnitDecl();
 
 
@@ -1160,7 +1160,7 @@
                                                  decl_ctx,
                                                  SourceLocation(),
                                                  SourceLocation(),
-                                                 is_anonymous ? NULL : &ast->Idents.get(name));
+                                                 is_anonymous ? nullptr : &ast->Idents.get(name));
     
     if (is_anonymous)
         decl->setAnonymousStructOrUnion(true);
@@ -1194,7 +1194,7 @@
     {
         const char *name = template_param_infos.names[i];
         
-        IdentifierInfo *identifier_info = NULL;
+        IdentifierInfo *identifier_info = nullptr;
         if (name && name[0])
             identifier_info = &ast->Idents.get(name);
         if (template_param_infos.args[i].getKind() == TemplateArgument::Integral)
@@ -1208,7 +1208,7 @@
                                                                              identifier_info,
                                                                              template_param_infos.args[i].getIntegralType(), 
                                                                              parameter_pack, 
-                                                                             NULL));
+                                                                             nullptr));
             
         }
         else
@@ -1277,7 +1277,7 @@
 
     func_decl->setFunctionTemplateSpecialization (func_tmpl_decl,
                                                   &template_args,
-                                                  NULL);
+                                                  nullptr);
 }
 
 
@@ -1290,8 +1290,8 @@
 {
     ASTContext *ast = getASTContext();
     
-    ClassTemplateDecl *class_template_decl = NULL;
-    if (decl_ctx == NULL)
+    ClassTemplateDecl *class_template_decl = nullptr;
+    if (decl_ctx == nullptr)
         decl_ctx = ast->getTranslationUnitDecl();
     
     IdentifierInfo &identifier_info = ast->Idents.get(class_name);
@@ -1337,7 +1337,7 @@
                                                      decl_name,
                                                      template_param_list,
                                                      template_cxx_decl,
-                                                     NULL);
+                                                     nullptr);
     
     if (class_template_decl)
     {
@@ -1373,7 +1373,7 @@
                                                                                                                    class_template_decl,
                                                                                                                    &template_param_infos.args.front(),
                                                                                                                    template_param_infos.args.size(),
-                                                                                                                   NULL);
+                                                                                                                   nullptr);
     
     class_template_specialization_decl->setSpecializationKind(TSK_ExplicitSpecialization);
     
@@ -1470,7 +1470,7 @@
     uint32_t& bitfield_bit_size
 )
 {
-    if (ast == NULL || field == NULL)
+    if (ast == nullptr || field == nullptr)
         return false;
 
     if (field->isBitField())
@@ -1492,7 +1492,7 @@
 bool
 ClangASTContext::RecordHasFields (const RecordDecl *record_decl)
 {
-    if (record_decl == NULL)
+    if (record_decl == nullptr)
         return false;
 
     if (!record_decl->field_empty())
@@ -1528,16 +1528,16 @@
 )
 {
     ASTContext *ast = getASTContext();
-    assert (ast != NULL);
+    assert (ast != nullptr);
     assert (name && name[0]);
-    if (decl_ctx == NULL)
+    if (decl_ctx == nullptr)
         decl_ctx = ast->getTranslationUnitDecl();
 
     ObjCInterfaceDecl *decl = ObjCInterfaceDecl::Create (*ast,
                                                          decl_ctx,
                                                          SourceLocation(),
                                                          &ast->Idents.get(name),
-                                                         NULL,
+                                                         nullptr,
                                                          SourceLocation(),
                                                          /*isForwardDecl,*/
                                                          isInternal);
@@ -1588,10 +1588,10 @@
 NamespaceDecl *
 ClangASTContext::GetUniqueNamespaceDeclaration (const char *name, DeclContext *decl_ctx)
 {
-    NamespaceDecl *namespace_decl = NULL;
+    NamespaceDecl *namespace_decl = nullptr;
     ASTContext *ast = getASTContext();
     TranslationUnitDecl *translation_unit_decl = ast->getTranslationUnitDecl ();
-    if (decl_ctx == NULL)
+    if (decl_ctx == nullptr)
         decl_ctx = translation_unit_decl;
     
     if (name)
@@ -1612,7 +1612,7 @@
                                                SourceLocation(), 
                                                SourceLocation(),
                                                &identifier_info,
-                                               NULL);
+                                               nullptr);
         
         decl_ctx->addDecl (namespace_decl);        
     }
@@ -1629,8 +1629,8 @@
                                                    false,
                                                    SourceLocation(),
                                                    SourceLocation(),
-                                                   NULL,
-                                                   NULL);
+                                                   nullptr,
+                                                   nullptr);
             translation_unit_decl->setAnonymousNamespace (namespace_decl);
             translation_unit_decl->addDecl (namespace_decl);
             assert (namespace_decl == translation_unit_decl->getAnonymousNamespace());
@@ -1648,8 +1648,8 @@
                                                        false,
                                                        SourceLocation(), 
                                                        SourceLocation(), 
-                                                       NULL,
-                                                       NULL);
+                                                       nullptr,
+                                                       nullptr);
                 parent_namespace_decl->setAnonymousNamespace (namespace_decl);
                 parent_namespace_decl->addDecl (namespace_decl);
                 assert (namespace_decl == parent_namespace_decl->getAnonymousNamespace());
@@ -1694,9 +1694,9 @@
                                             int storage,
                                             bool is_inline)
 {
-    FunctionDecl *func_decl = NULL;
+    FunctionDecl *func_decl = nullptr;
     ASTContext *ast = getASTContext();
-    if (decl_ctx == NULL)
+    if (decl_ctx == nullptr)
         decl_ctx = ast->getTranslationUnitDecl();
 
     
@@ -1711,7 +1711,7 @@
                                           SourceLocation(),
                                           DeclarationName (&ast->Idents.get(name)),
                                           function_clang_type.GetQualType(),
-                                          NULL,
+                                          nullptr,
                                           (FunctionDecl::StorageClass)storage,
                                           is_inline,
                                           hasWrittenPrototype,
@@ -1725,7 +1725,7 @@
                                           SourceLocation(),
                                           DeclarationName (),
                                           function_clang_type.GetQualType(),
-                                          NULL,
+                                          nullptr,
                                           (FunctionDecl::StorageClass)storage,
                                           is_inline,
                                           hasWrittenPrototype,
@@ -1749,7 +1749,7 @@
                                      bool is_variadic, 
                                      unsigned type_quals)
 {
-    assert (ast != NULL);
+    assert (ast != nullptr);
     std::vector<QualType> qual_type_args;
     for (unsigned i=0; i<num_args; ++i)
         qual_type_args.push_back (args[i].GetQualType());
@@ -1761,7 +1761,7 @@
     proto_info.TypeQuals = type_quals;
     proto_info.RefQualifier = RQ_None;
     proto_info.NumExceptions = 0;
-    proto_info.Exceptions = NULL;
+    proto_info.Exceptions = nullptr;
     
     return ClangASTType (ast, ast->getFunctionType (result_type.GetQualType(),
                                                     qual_type_args,
@@ -1772,16 +1772,16 @@
 ClangASTContext::CreateParameterDeclaration (const char *name, const ClangASTType &param_type, int storage)
 {
     ASTContext *ast = getASTContext();
-    assert (ast != NULL);
+    assert (ast != nullptr);
     return ParmVarDecl::Create(*ast,
                                 ast->getTranslationUnitDecl(),
                                 SourceLocation(),
                                 SourceLocation(),
-                                name && name[0] ? &ast->Idents.get(name) : NULL,
+                                name && name[0] ? &ast->Idents.get(name) : nullptr,
                                 param_type.GetQualType(),
-                                NULL,
+                                nullptr,
                                 (VarDecl::StorageClass)storage,
-                                0);
+                                nullptr);
 }
 
 void
@@ -1802,7 +1802,7 @@
     if (element_type.IsValid())
     {
         ASTContext *ast = getASTContext();
-        assert (ast != NULL);
+        assert (ast != nullptr);
 
         if (is_vector)
         {
@@ -1855,8 +1855,8 @@
                                             decl_ctx,
                                             SourceLocation(),
                                             SourceLocation(),
-                                            name && name[0] ? &ast->Idents.get(name) : NULL,
-                                            NULL, 
+                                            name && name[0] ? &ast->Idents.get(name) : nullptr,
+                                            nullptr,
                                             false,  // IsScoped
                                             false,  // IsScopedUsingClassTag
                                             false); // IsFixed
@@ -2007,7 +2007,7 @@
     if (external_source && external_source->HasMetadata(object))
         return external_source->GetMetadata(object);
     else
-        return NULL;
+        return nullptr;
 }
 
 clang::DeclContext *