diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-07-22 11:30:19 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-07-22 11:30:19 +0000 |
commit | 664cffd330611d78fc0286f539589920a37ca328 (patch) | |
tree | f6fb4eb838cee65608944f6a53acd233ecd46c6c | |
parent | 1f3b4a98d4c5d814f472b4068571422b5650af87 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109097 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/libclang/CIndex.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 47c6d3ca3f..0a3d54b6cb 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -520,7 +520,10 @@ bool CursorVisitor::VisitBlockDecl(BlockDecl *B) { 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) { |