libclang: audit all APIs that accept a CXTranslationUnit to make sure that
checks for invalid translation unit are in place.  Also, while there, add log
output for this case.

llvm-svn: 201155
diff --git a/clang/tools/libclang/Indexing.cpp b/clang/tools/libclang/Indexing.cpp
index 99fcdb6..7fb27bf 100644
--- a/clang/tools/libclang/Indexing.cpp
+++ b/clang/tools/libclang/Indexing.cpp
@@ -756,8 +756,10 @@
   unsigned index_options = ITUI->index_options;
   ITUI->result = 1; // init as error.
 
-  if (!TU)
+  if (isNotUseableTU(TU)) {
+    LOG_BAD_TU(TU);
     return;
+  }
   if (!client_index_callbacks || index_callbacks_size == 0)
     return;