Install a diagnostic consumer into each new AST
context as the first thing we do.  This prevents
crashes if some of the initial setup produces
messages or errors.

<rdar://problem/20457882>

llvm-svn: 234511
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index c7eef43..8495e1e 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -401,6 +401,9 @@
                                        *getIdentifierTable(),
                                        *getSelectorTable(),
                                        *getBuiltinContext()));
+        
+        m_ast_ap->getDiagnostics().setClient(getDiagnosticConsumer(), false);
+        
         m_ast_ap->InitBuiltinTypes(*getTargetInfo());
         
         if ((m_callback_tag_decl || m_callback_objc_decl) && m_callback_baton)
@@ -409,8 +412,6 @@
             //m_ast_ap->getTranslationUnitDecl()->setHasExternalVisibleStorage();
         }
         
-        m_ast_ap->getDiagnostics().setClient(getDiagnosticConsumer(), false);
-        
         GetASTMap().Insert(m_ast_ap.get(), this);
     }
     return m_ast_ap.get();