Replace NULL with nullptr

Also fixed some lines that were too long, and a few other minor
details.

Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
diff --git a/compiler/driver/compiler_driver-inl.h b/compiler/driver/compiler_driver-inl.h
index b4d4695..bad8335 100644
--- a/compiler/driver/compiler_driver-inl.h
+++ b/compiler/driver/compiler_driver-inl.h
@@ -79,7 +79,7 @@
   }
   if (UNLIKELY(resolved_field->IsStatic() != is_static)) {
     // ClassLinker can return a field of the wrong kind directly from the DexCache.
-    // Silently return nullptr on such incompatible class change.
+    // Silently return null on such incompatible class change.
     return nullptr;
   }
   return resolved_field;
@@ -206,7 +206,7 @@
   }
   if (check_incompatible_class_change &&
       UNLIKELY(resolved_method->CheckIncompatibleClassChange(invoke_type))) {
-    // Silently return nullptr on incompatible class change.
+    // Silently return null on incompatible class change.
     return nullptr;
   }
   return resolved_method;
@@ -302,7 +302,7 @@
                                                   target_dex_cache, class_loader,
                                                   NullHandle<mirror::ArtMethod>(), kVirtual);
     }
-    CHECK(called_method != NULL);
+    CHECK(called_method != nullptr);
     CHECK(!called_method->IsAbstract());
     int stats_flags = kFlagMethodResolved;
     GetCodeAndMethodForDirectCall(/*out*/invoke_type,
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index e665e1d..c858326 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -495,7 +495,8 @@
                                 const std::vector<const DexFile*>& dex_files,
                                 TimingLogger* timings) {
   DCHECK(!Runtime::Current()->IsStarted());
-  std::unique_ptr<ThreadPool> thread_pool(new ThreadPool("Compiler driver thread pool", thread_count_ - 1));
+  std::unique_ptr<ThreadPool> thread_pool(
+      new ThreadPool("Compiler driver thread pool", thread_count_ - 1));
   VLOG(compiler) << "Before precompile " << GetMemoryUsageString(false);
   PreCompile(class_loader, dex_files, thread_pool.get(), timings);
   Compile(class_loader, dex_files, thread_pool.get(), timings);
@@ -2101,7 +2102,8 @@
   VLOG(compiler) << "Compile: " << GetMemoryUsageString(false);
 }
 
-void CompilerDriver::CompileClass(const ParallelCompilationManager* manager, size_t class_def_index) {
+void CompilerDriver::CompileClass(const ParallelCompilationManager* manager,
+                                  size_t class_def_index) {
   ATRACE_CALL();
   const DexFile& dex_file = *manager->GetDexFile();
   const DexFile::ClassDef& class_def = dex_file.GetClassDef(class_def_index);
@@ -2251,7 +2253,7 @@
                    // Is eligable for compilation by methods-to-compile filter.
                    IsMethodToCompile(method_ref);
     if (compile) {
-      // NOTE: if compiler declines to compile this method, it will return nullptr.
+      // NOTE: if compiler declines to compile this method, it will return null.
       compiled_method = compiler_->Compile(code_item, access_flags, invoke_type, class_def_idx,
                                            method_idx, class_loader, dex_file);
     }
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index 50e1fb1..03c5c5c 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -94,7 +94,7 @@
   // Create a compiler targeting the requested "instruction_set".
   // "image" should be true if image specific optimizations should be
   // enabled.  "image_classes" lets the compiler know what classes it
-  // can assume will be in the image, with nullptr implying all available
+  // can assume will be in the image, with null implying all available
   // classes.
   explicit CompilerDriver(const CompilerOptions* compiler_options,
                           VerificationResults* verification_results,
@@ -228,7 +228,7 @@
   mirror::ClassLoader* GetClassLoader(ScopedObjectAccess& soa, const DexCompilationUnit* mUnit)
     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
-  // Resolve compiling method's class. Returns nullptr on failure.
+  // Resolve compiling method's class. Returns null on failure.
   mirror::Class* ResolveCompilingMethodsClass(
       const ScopedObjectAccess& soa, Handle<mirror::DexCache> dex_cache,
       Handle<mirror::ClassLoader> class_loader, const DexCompilationUnit* mUnit)
@@ -240,7 +240,7 @@
       const DexCompilationUnit* mUnit)
     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
-  // Resolve a field. Returns nullptr on failure, including incompatible class change.
+  // Resolve a field. Returns null on failure, including incompatible class change.
   // NOTE: Unlike ClassLinker's ResolveField(), this method enforces is_static.
   ArtField* ResolveField(
       const ScopedObjectAccess& soa, Handle<mirror::DexCache> dex_cache,
@@ -290,7 +290,7 @@
                                       ArtField* resolved_field)
     SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
 
-  // Resolve a method. Returns nullptr on failure, including incompatible class change.
+  // Resolve a method. Returns null on failure, including incompatible class change.
   mirror::ArtMethod* ResolveMethod(
       ScopedObjectAccess& soa, Handle<mirror::DexCache> dex_cache,
       Handle<mirror::ClassLoader> class_loader, const DexCompilationUnit* mUnit,
@@ -592,16 +592,16 @@
   const bool image_;
 
   // If image_ is true, specifies the classes that will be included in
-  // the image. Note if image_classes_ is nullptr, all classes are
+  // the image. Note if image_classes_ is null, all classes are
   // included in the image.
   std::unique_ptr<std::unordered_set<std::string>> image_classes_;
 
-  // Specifies the classes that will be compiled. Note that if classes_to_compile_ is nullptr,
+  // Specifies the classes that will be compiled. Note that if classes_to_compile_ is null,
   // all classes are eligible for compilation (duplication filters etc. will still apply).
   // This option may be restricted to the boot image, depending on a flag in the implementation.
   std::unique_ptr<std::unordered_set<std::string>> classes_to_compile_;
 
-  // Specifies the methods that will be compiled. Note that if methods_to_compile_ is nullptr,
+  // Specifies the methods that will be compiled. Note that if methods_to_compile_ is null,
   // all methods are eligible for compilation (compilation filters etc. will still apply).
   // This option may be restricted to the boot image, depending on a flag in the implementation.
   std::unique_ptr<std::unordered_set<std::string>> methods_to_compile_;
diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc
index ded50ca..5085f32 100644
--- a/compiler/driver/compiler_driver_test.cc
+++ b/compiler/driver/compiler_driver_test.cc
@@ -56,20 +56,20 @@
     CHECK(started);
     env_ = Thread::Current()->GetJniEnv();
     class_ = env_->FindClass(class_name);
-    CHECK(class_ != NULL) << "Class not found: " << class_name;
+    CHECK(class_ != nullptr) << "Class not found: " << class_name;
     if (is_virtual) {
       mid_ = env_->GetMethodID(class_, method, signature);
     } else {
       mid_ = env_->GetStaticMethodID(class_, method, signature);
     }
-    CHECK(mid_ != NULL) << "Method not found: " << class_name << "." << method << signature;
+    CHECK(mid_ != nullptr) << "Method not found: " << class_name << "." << method << signature;
   }
 
   void MakeAllExecutable(jobject class_loader) {
     const std::vector<const DexFile*> class_path = GetDexFiles(class_loader);
     for (size_t i = 0; i != class_path.size(); ++i) {
       const DexFile* dex_file = class_path[i];
-      CHECK(dex_file != NULL);
+      CHECK(dex_file != nullptr);
       MakeDexFileExecutable(class_loader, *dex_file);
     }
   }
@@ -84,7 +84,7 @@
       Handle<mirror::ClassLoader> loader(
           hs.NewHandle(soa.Decode<mirror::ClassLoader*>(class_loader)));
       mirror::Class* c = class_linker->FindClass(soa.Self(), descriptor, loader);
-      CHECK(c != NULL);
+      CHECK(c != nullptr);
       for (size_t j = 0; j < c->NumDirectMethods(); j++) {
         MakeExecutable(c->GetDirectMethod(j));
       }
@@ -101,39 +101,38 @@
 
 // Disabled due to 10 second runtime on host
 TEST_F(CompilerDriverTest, DISABLED_LARGE_CompileDexLibCore) {
-  CompileAll(NULL);
+  CompileAll(nullptr);
 
   // All libcore references should resolve
   ScopedObjectAccess soa(Thread::Current());
-  ASSERT_TRUE(java_lang_dex_file_ != NULL);
+  ASSERT_TRUE(java_lang_dex_file_ != nullptr);
   const DexFile& dex = *java_lang_dex_file_;
   mirror::DexCache* dex_cache = class_linker_->FindDexCache(dex);
   EXPECT_EQ(dex.NumStringIds(), dex_cache->NumStrings());
   for (size_t i = 0; i < dex_cache->NumStrings(); i++) {
     const mirror::String* string = dex_cache->GetResolvedString(i);
-    EXPECT_TRUE(string != NULL) << "string_idx=" << i;
+    EXPECT_TRUE(string != nullptr) << "string_idx=" << i;
   }
   EXPECT_EQ(dex.NumTypeIds(), dex_cache->NumResolvedTypes());
   for (size_t i = 0; i < dex_cache->NumResolvedTypes(); i++) {
     mirror::Class* type = dex_cache->GetResolvedType(i);
-    EXPECT_TRUE(type != NULL) << "type_idx=" << i
+    EXPECT_TRUE(type != nullptr) << "type_idx=" << i
                               << " " << dex.GetTypeDescriptor(dex.GetTypeId(i));
   }
   EXPECT_EQ(dex.NumMethodIds(), dex_cache->NumResolvedMethods());
   for (size_t i = 0; i < dex_cache->NumResolvedMethods(); i++) {
     mirror::ArtMethod* method = dex_cache->GetResolvedMethod(i);
-    EXPECT_TRUE(method != NULL) << "method_idx=" << i
+    EXPECT_TRUE(method != nullptr) << "method_idx=" << i
                                 << " " << dex.GetMethodDeclaringClassDescriptor(dex.GetMethodId(i))
                                 << " " << dex.GetMethodName(dex.GetMethodId(i));
-    EXPECT_TRUE(method->GetEntryPointFromQuickCompiledCode() != NULL) << "method_idx=" << i
-                                           << " "
-                                           << dex.GetMethodDeclaringClassDescriptor(dex.GetMethodId(i))
-                                           << " " << dex.GetMethodName(dex.GetMethodId(i));
+    EXPECT_TRUE(method->GetEntryPointFromQuickCompiledCode() != nullptr) << "method_idx=" << i
+        << " " << dex.GetMethodDeclaringClassDescriptor(dex.GetMethodId(i)) << " "
+        << dex.GetMethodName(dex.GetMethodId(i));
   }
   EXPECT_EQ(dex.NumFieldIds(), dex_cache->NumResolvedFields());
   for (size_t i = 0; i < dex_cache->NumResolvedFields(); i++) {
     ArtField* field = Runtime::Current()->GetClassLinker()->GetResolvedField(i, dex_cache);
-    EXPECT_TRUE(field != NULL) << "field_idx=" << i
+    EXPECT_TRUE(field != nullptr) << "field_idx=" << i
                                << " " << dex.GetFieldDeclaringClassDescriptor(dex.GetFieldId(i))
                                << " " << dex.GetFieldName(dex.GetFieldId(i));
   }
@@ -153,14 +152,14 @@
     CompileDirectMethod(NullHandle<mirror::ClassLoader>(), "java.lang.Object", "<init>", "()V");
     class_loader = LoadDex("AbstractMethod");
   }
-  ASSERT_TRUE(class_loader != NULL);
+  ASSERT_TRUE(class_loader != nullptr);
   EnsureCompiled(class_loader, "AbstractClass", "foo", "()V", true);
 
   // Create a jobj_ of ConcreteClass, NOT AbstractClass.
   jclass c_class = env_->FindClass("ConcreteClass");
   jmethodID constructor = env_->GetMethodID(c_class, "<init>", "()V");
   jobject jobj_ = env_->NewObject(c_class, constructor);
-  ASSERT_TRUE(jobj_ != NULL);
+  ASSERT_TRUE(jobj_ != nullptr);
 
   // Force non-virtual call to AbstractClass foo, will throw AbstractMethodError exception.
   env_->CallNonvirtualVoidMethod(jobj_, class_, mid_);