diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-01-16 18:13:00 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-01-16 18:13:00 +0000 |
commit | d7bf4a4e9c100fb5fe098b0e1870d61891c09dd3 (patch) | |
tree | 17e0ac27c0fb4f61e1ea1d2b5b23aacb2d3beacb | |
parent | f7f12646e8f8a45abea3ebcb81928fbe08187f97 (diff) |
[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
-rw-r--r-- | tools/libclang/CIndex.cpp | 5 |
1 files 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<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(); |