Add some missing concurrency checks into libclang

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114682 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 6d6938a..d2d0057 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -2309,6 +2309,7 @@
   unsigned options;
   int result;
 };
+
 static void clang_reparseTranslationUnit_Impl(void *UserData) {
   ReparseTranslationUnitInfo *RTUI =
     static_cast<ReparseTranslationUnitInfo*>(UserData);
@@ -2321,6 +2322,9 @@
 
   if (!TU)
     return;
+
+  ASTUnit *CXXUnit = static_cast<ASTUnit *>(TU);
+  ASTUnit::ConcurrencyCheck Check(*CXXUnit);
   
   llvm::SmallVector<ASTUnit::RemappedFile, 4> RemappedFiles;
   for (unsigned I = 0; I != num_unsaved_files; ++I) {
@@ -2331,10 +2335,10 @@
                                            Buffer));
   }
   
-  if (!static_cast<ASTUnit *>(TU)->Reparse(RemappedFiles.data(),
-                                           RemappedFiles.size()))
-      RTUI->result = 0;
+  if (!CXXUnit->Reparse(RemappedFiles.data(), RemappedFiles.size()))
+    RTUI->result = 0;
 }
+
 int clang_reparseTranslationUnit(CXTranslationUnit TU,
                                  unsigned num_unsaved_files,
                                  struct CXUnsavedFile *unsaved_files,