From: Douglas Gregor Date: Fri, 22 Apr 2011 23:49:24 +0000 (+0000) Subject: Teach libclang to be more careful around BlockDecls, and don't assume X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=13c8ccb59b38e9e7133f1c80a00f210b6514a0b1;p=clang Teach libclang to be more careful around BlockDecls, and don't assume that a TypeSourceInfo is always available, like we do everywhere else in libclang. Fixes . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130034 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index c1d48388c8..98edd521ef 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -582,8 +582,9 @@ bool CursorVisitor::VisitChildren(CXCursor Cursor) { } bool CursorVisitor::VisitBlockDecl(BlockDecl *B) { - if (Visit(B->getSignatureAsWritten()->getTypeLoc())) - return true; + if (TypeSourceInfo *TSInfo = B->getSignatureAsWritten()) + if (Visit(TSInfo->getTypeLoc())) + return true; if (Stmt *Body = B->getBody()) return Visit(MakeCXCursor(Body, StmtParent, TU));