aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-04-22 23:49:24 +0000
committerDouglas Gregor <dgregor@apple.com>2011-04-22 23:49:24 +0000
commit13c8ccb59b38e9e7133f1c80a00f210b6514a0b1 (patch)
tree4bb66edcdbf12cf33bac380f4d7d9a4e50daea35
parent32c1388f0feef4ea147f881415f5a7225e8cadcc (diff)
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 <rdar://problem/9311140>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130034 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/libclang/CIndex.cpp5
1 files changed, 3 insertions, 2 deletions
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));