[lldb][NFC] Disallow changing the ASTContext of an ClangASTContext after construction.

We have no use case in LLDB where we actually do want to change the ASTContext after
it the ClangASTContext has been constructed. All callers of setASTContext are just setting
the ASTContext directly after construction, so we might as well make this a Constructor
instead of supporting this tricky use case.

llvm-svn: 373330
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 891410d..db962d5 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -528,6 +528,14 @@
     SetTargetTriple(target_triple);
 }
 
+ClangASTContext::ClangASTContext(ASTContext &existing_ctxt)
+  : TypeSystem(TypeSystem::eKindClang) {
+  SetTargetTriple(existing_ctxt.getTargetInfo().getTriple().str());
+
+  m_ast_up.reset(&existing_ctxt);
+  GetASTMap().Insert(&existing_ctxt, this);
+}
+
 // Destructor
 ClangASTContext::~ClangASTContext() { Finalize(); }
 
@@ -706,15 +714,6 @@
   }
 }
 
-void ClangASTContext::setASTContext(clang::ASTContext *ast_ctx) {
-  if (!m_ast_owned) {
-    m_ast_up.release();
-  }
-  m_ast_owned = false;
-  m_ast_up.reset(ast_ctx);
-  GetASTMap().Insert(ast_ctx, this);
-}
-
 ASTContext *ClangASTContext::getASTContext() {
   if (m_ast_up == nullptr) {
     m_ast_owned = true;