Changes for vogar compatibility

Make sure dex2oat can make an image with an empty list of image_classes.
Add in some checks to make sure that no bad arguments sneak into
CompilerDriver.

If we're not on the ART_TARGET, we should check for the "hostdex"
versions of the libraries to substitute in our libart version.

Change-Id: I5e8485c6089d25664492f0217b43ef64ca84c061
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 6817f14..ff4806b 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -377,8 +377,10 @@
   compiler_->Init();
 
   CHECK(!Runtime::Current()->IsStarted());
-  if (!image_) {
-    CHECK(image_classes_.get() == NULL);
+  if (image_) {
+    CHECK(image_classes_.get() != nullptr);
+  } else {
+    CHECK(image_classes_.get() == nullptr);
   }
 
   // Are we generating CFI information?
@@ -591,7 +593,7 @@
                              ThreadPool* thread_pool, TimingLogger* timings) {
   for (size_t i = 0; i != dex_files.size(); ++i) {
     const DexFile* dex_file = dex_files[i];
-    CHECK(dex_file != NULL);
+    CHECK(dex_file != nullptr);
     ResolveDexFile(class_loader, *dex_file, thread_pool, timings);
   }
 }
@@ -689,6 +691,7 @@
 // Make a list of descriptors for classes to include in the image
 void CompilerDriver::LoadImageClasses(TimingLogger* timings)
       LOCKS_EXCLUDED(Locks::mutator_lock_) {
+  CHECK(timings != nullptr);
   if (!IsImage()) {
     return;
   }
@@ -698,6 +701,7 @@
   Thread* self = Thread::Current();
   ScopedObjectAccess soa(self);
   ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
+  CHECK(image_classes_.get() != nullptr);
   for (auto it = image_classes_->begin(), end = image_classes_->end(); it != end;) {
     const std::string& descriptor(*it);
     SirtRef<mirror::Class> klass(self, class_linker->FindSystemClass(self, descriptor.c_str()));