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

Ted Kremenek kremenek at apple.com
Thu Jul 22 04:30:20 PDT 2010


Author: kremenek
Date: Thu Jul 22 06:30:19 2010
New Revision: 109097

URL: http://llvm.org/viewvc/llvm-project?rev=109097&view=rev
Log:
Fix '<rdar://problem/8214263> MakeCXCursor null dereference when body of block is invalid' by checking that the body of a BlockDecl is null before constructing a CXCursor.

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=109097&r1=109096&r2=109097&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Thu Jul 22 06:30:19 2010
@@ -520,7 +520,10 @@
   if (Visit(B->getSignatureAsWritten()->getTypeLoc()))
     return true;
 
-  return Visit(MakeCXCursor(B->getBody(), StmtParent, TU));
+  if (Stmt *Body = B->getBody())
+    return Visit(MakeCXCursor(Body, StmtParent, TU));
+
+  return false;
 }
 
 bool CursorVisitor::VisitDeclContext(DeclContext *DC) {





More information about the cfe-commits mailing list