[libclang] If displayDiagnostics is set (when calling clang_createIndex), make sure to
output the errors that occurred even if we did not get an AST (e.g. because the
PCH failed to load).

Also honor displayDiagnostics in clang_indexSourceFile().

rdar://11203489

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154472 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndexer.h b/tools/libclang/CIndexer.h
index 8a249f0..1e5fb82 100644
--- a/tools/libclang/CIndexer.h
+++ b/tools/libclang/CIndexer.h
@@ -25,6 +25,7 @@
 }
 
 namespace clang {
+  class ASTUnit;
 
 class CIndexer {
   bool OnlyLocalDecls;
@@ -94,6 +95,10 @@
 
   /// \brief Print libclang's resource usage to standard error.
   void PrintLibclangResourceUsage(CXTranslationUnit TU);
+
+  namespace cxindex {
+    void printDiagsToStderr(ASTUnit *Unit);
+  }
 }
 
 #endif