libclang: fix a crash in clang_disposeDiagnosticSet when it is passed a NULL argument

llvm-svn: 201236
This commit is contained in:
Dmitri Gribenko 2014-02-12 14:17:58 +00:00
parent 254c7636cf
commit 371c217b3f
1 changed files with 4 additions and 3 deletions

View File

@ -450,9 +450,10 @@ CXString clang_getDiagnosticFixIt(CXDiagnostic Diag, unsigned FixIt,
} }
void clang_disposeDiagnosticSet(CXDiagnosticSet Diags) { void clang_disposeDiagnosticSet(CXDiagnosticSet Diags) {
CXDiagnosticSetImpl *D = static_cast<CXDiagnosticSetImpl*>(Diags); if (CXDiagnosticSetImpl *D = static_cast<CXDiagnosticSetImpl *>(Diags)) {
if (D->isExternallyManaged()) if (D->isExternallyManaged())
delete D; delete D;
}
} }
CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags, CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags,