Generate a dependency file for C++ output

Bug: 23600457
Test: unittests, added another

Change-Id: Ic1834badc396d444057a58f3868bcf343dcc933d
diff --git a/aidl.cpp b/aidl.cpp
index 9ba25d1..7459f8f 100644
--- a/aidl.cpp
+++ b/aidl.cpp
@@ -596,7 +596,11 @@
     return err;
   }
 
-  // TODO(wiley) b/23600457 generate a dependency file if requested with -b
+  string dep_file_name = options.DependencyFilePath();
+  if (!dep_file_name.empty()) {
+    generate_dep_file(dep_file_name, options.InputFileName(),
+                      options.OutputCppFilePath(), imports, io_delegate);
+  }
 
   return (cpp::GenerateCpp(options, *types, *interface, io_delegate)) ? 0 : 1;
 }