diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-02-23 04:54:51 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-02-23 04:54:51 +0000 |
commit | c49211c79a53926bd529bc9e74e44352131b5fdb (patch) | |
tree | b3688600dd1074eb2b43e9b3c1379c069603f708 | |
parent | d99dbcc2a9d257c3572030d27cb5fc32d5dbd093 (diff) | |
download | bcm5719-llvm-c49211c79a53926bd529bc9e74e44352131b5fdb.tar.gz bcm5719-llvm-c49211c79a53926bd529bc9e74e44352131b5fdb.zip |
Add null check in CursorVisitor::RunVisitorWorkList() when visiting LabelDecls. Fixes <rdar://problem/9040579>.
llvm-svn: 126304
-rw-r--r-- | clang/tools/libclang/CIndex.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index e2882953c08..328ea62f3b4 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/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: { |