Revert my CIndex diagnostic changes (r96603, 96606, 96607), which were
breaking the msvc9 builder for unknown reasons.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96618 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index 6e07ece..8bb6a0a 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -27,7 +27,6 @@
 #include "clang/Lex/Preprocessor.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/System/Program.h"
-#include "llvm/System/Signals.h"
 
 // Needed to define L_TMPNAM on some systems.
 #include <cstdio>
@@ -904,13 +903,10 @@
 }
 
 extern "C" {
-CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
-                          int displayDiagnostics) {
+CXIndex clang_createIndex(int excludeDeclarationsFromPCH) {
   CIndexer *CIdxr = new CIndexer();
   if (excludeDeclarationsFromPCH)
     CIdxr->setOnlyLocalDecls();
-  if (displayDiagnostics)
-    CIdxr->setDisplayDiagnostics();
   return CIdxr;
 }
 
@@ -997,18 +993,8 @@
 
     // FIXME: Until we have broader testing, just drop the entire AST if we
     // encountered an error.
-    if (NumErrors != Diags->getNumErrors()) {
-      if (CXXIdx->getDisplayDiagnostics()) {
-        for (ASTUnit::diag_iterator D = Unit->diag_begin(), 
-                                 DEnd = Unit->diag_end();
-             D != DEnd; ++D) {
-          CXStoredDiagnostic Diag(*D, Unit->getASTContext().getLangOptions());
-          clang_displayDiagnostic(&Diag, stderr,
-                                  clang_defaultDiagnosticDisplayOptions());
-        }
-      }
+    if (NumErrors != Diags->getNumErrors())
       return 0;
-    }
 
     return Unit.take();
   }
@@ -1099,35 +1085,18 @@
                                           RemappedFiles.data(),
                                           RemappedFiles.size(),
                                           /*CaptureDiagnostics=*/true);
+  if (ATU)
+    ATU->unlinkTemporaryFile();
+
+  // FIXME: Currently we don't report diagnostics on invalid ASTs.
   if (ATU) {
     LoadSerializedDiagnostics(DiagnosticsFile, 
                               num_unsaved_files, unsaved_files,
                               ATU->getFileManager(),
                               ATU->getSourceManager(),
                               ATU->getDiagnostics());
-  } else if (CXXIdx->getDisplayDiagnostics()) {
-    // We failed to load the ASTUnit, but we can still deserialize the
-    // diagnostics and emit them.
-    FileManager FileMgr;
-    SourceManager SourceMgr;
-    // FIXME: Faked LangOpts!
-    LangOptions LangOpts;
-    llvm::SmallVector<StoredDiagnostic, 4> Diags;
-    LoadSerializedDiagnostics(DiagnosticsFile, 
-                              num_unsaved_files, unsaved_files,
-                              FileMgr, SourceMgr, Diags);
-    for (llvm::SmallVector<StoredDiagnostic, 4>::iterator D = Diags.begin(), 
-                                                       DEnd = Diags.end();
-         D != DEnd; ++D) {
-      CXStoredDiagnostic Diag(*D, LangOpts);
-      clang_displayDiagnostic(&Diag, stderr,
-                              clang_defaultDiagnosticDisplayOptions());
-    }
   }
 
-  if (ATU)
-    ATU->unlinkTemporaryFile();
-
   for (unsigned i = 0, e = TemporaryFiles.size(); i != e; ++i)
     TemporaryFiles[i].eraseFromDisk();
 
@@ -1936,10 +1905,6 @@
   *endColumn = SM.getSpellingColumnNumber(Body->getRBracLoc());
 }
 
-void clang_enableStackTraces(void) {
-  llvm::sys::PrintStackTraceOnErrorSignal();
-}
-
 } // end: extern "C"
 
 //===----------------------------------------------------------------------===//