]> granicus.if.org Git - clang/commitdiff
Teach libclang to be more careful around BlockDecls, and don't assume
authorDouglas Gregor <dgregor@apple.com>
Fri, 22 Apr 2011 23:49:24 +0000 (23:49 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 22 Apr 2011 23:49:24 +0000 (23:49 +0000)
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

tools/libclang/CIndex.cpp

index c1d48388c8c533379b27c18175a696821b927454..98edd521ef4bf2b032628feab996f1c47ef3812e 100644 (file)
@@ -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));