[cfe-commits] r172632 - /cfe/trunk/tools/libclang/CIndex.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Wed Jan 16 10:13:00 PST 2013


Author: akirtzidis
Date: Wed Jan 16 12:13:00 2013
New Revision: 172632

URL: http://llvm.org/viewvc/llvm-project?rev=172632&view=rev
Log:
[libclang] In clang_reparseTranslationUnit_Impl, move the check whether TU is
null before using it.

Modified:
    cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=172632&r1=172631&r2=172632&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Wed Jan 16 12:13:00 2013
@@ -2834,6 +2834,8 @@
   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 @@
   (void) options;
   RTUI->result = 1;
 
-  if (!TU)
-    return;
-
   CIndexer *CXXIdx = (CIndexer*)TU->CIdx;
   if (CXXIdx->isOptEnabled(CXGlobalOpt_ThreadBackgroundPriorityForEditing))
     setThreadBackgroundPriority();





More information about the cfe-commits mailing list