[cfe-commits] r126304 - /cfe/trunk/tools/libclang/CIndex.cpp

Ted Kremenek kremenek at apple.com
Tue Feb 22 20:54:52 PST 2011


Author: kremenek
Date: Tue Feb 22 22:54:51 2011
New Revision: 126304

URL: http://llvm.org/viewvc/llvm-project?rev=126304&view=rev
Log:
Add null check in CursorVisitor::RunVisitorWorkList() when visiting LabelDecls.  Fixes <rdar://problem/9040579>.

Modified:
    cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=126304&r1=126303&r2=126304&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Tue Feb 22 22:54:51 2011
@@ -1983,10 +1983,12 @@
       }
       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: {





More information about the cfe-commits mailing list