aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-02-23 04:54:51 +0000
committerTed Kremenek <kremenek@apple.com>2011-02-23 04:54:51 +0000
commite7455016e5fae3db7e2d88a61633f76ab05fc9d3 (patch)
treecd6edb87600b8c6f955ab28e158cddf18802bc52
parent729b853f4bfa83e53c638a06a9dccf83b4e1f720 (diff)
Add null check in CursorVisitor::RunVisitorWorkList() when visiting LabelDecls. Fixes <rdar://problem/9040579>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126304 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/libclang/CIndex.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index e2882953c0..328ea62f3b 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -1983,10 +1983,12 @@ bool CursorVisitor::RunVisitorWorkList(VisitorWorkList &WL) {
}
case VisitorJob::LabelRefVisitKind: {
LabelDecl *LS = cast<LabelRefVisit>(&LI)->get();
- if (Visit(MakeCursorLabelRef(LS->getStmt(),
- cast<LabelRefVisit>(&LI)->getLoc(),
- TU)))
- return true;
+ if (LabelStmt *stmt = LS->getStmt()) {
+ if (Visit(MakeCursorLabelRef(stmt, cast<LabelRefVisit>(&LI)->getLoc(),
+ TU))) {
+ return true;
+ }
+ }
continue;
}
case VisitorJob::NestedNameSpecifierVisitKind: {