]> granicus.if.org Git - clang/commitdiff
[libclang] In clang_reparseTranslationUnit_Impl, move the check whether TU is
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 16 Jan 2013 18:13:00 +0000 (18:13 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 16 Jan 2013 18:13:00 +0000 (18:13 +0000)
null before using it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172632 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/CIndex.cpp

index 7b271dcd50250da009d471b3095e03f11d1a72ed..6f790ae6852067db50ce84761758054e130377c3 100644 (file)
@@ -2834,6 +2834,8 @@ static void clang_reparseTranslationUnit_Impl(void *UserData) {
   ReparseTranslationUnitInfo *RTUI =
     static_cast<ReparseTranslationUnitInfo*>(UserData);
   CXTranslationUnit TU = RTUI->TU;
+  if (!TU)
+    return;
 
   // Reset the associated diagnostics.
   delete static_cast<CXDiagnosticSetImpl*>(TU->Diagnostics);
@@ -2845,9 +2847,6 @@ static void clang_reparseTranslationUnit_Impl(void *UserData) {
   (void) options;
   RTUI->result = 1;
 
-  if (!TU)
-    return;
-
   CIndexer *CXXIdx = (CIndexer*)TU->CIdx;
   if (CXXIdx->isOptEnabled(CXGlobalOpt_ThreadBackgroundPriorityForEditing))
     setThreadBackgroundPriority();