From d7bf4a4e9c100fb5fe098b0e1870d61891c09dd3 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172632 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/libclang/CIndex.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 7b271dcd50..6f790ae685 100644 --- a/tools/libclang/CIndex.cpp +++ b/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.40.0