From da4ba8718189d97f0af5d3b0f4ffbb6be7a1ce4c Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 16 Jan 2013 18:13:00 +0000 Subject: [PATCH] [libclang] In clang_reparseTranslationUnit_Impl, move the check whether TU is null before using it. llvm-svn: 172632 --- clang/tools/libclang/CIndex.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 7b271dc..6f790ae 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -2834,6 +2834,8 @@ static void clang_reparseTranslationUnit_Impl(void *UserData) { ReparseTranslationUnitInfo *RTUI = static_cast(UserData); CXTranslationUnit TU = RTUI->TU; + if (!TU) + return; // Reset the associated diagnostics. delete static_cast(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(); -- 2.7.4