[PATCH] D41575: [index] Return when DC is null in handleReference

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 25 14:44:06 PST 2017

MaskRay created this revision.
Herald added a subscriber: cfe-commits.

DC may sometimes be NULL and getContainerInfo(DC, Container) will fail.

  rC Clang



Index: tools/libclang/CXIndexDataConsumer.cpp
--- tools/libclang/CXIndexDataConsumer.cpp
+++ tools/libclang/CXIndexDataConsumer.cpp
@@ -890,7 +890,7 @@
                                       const DeclContext *DC,
                                       const Expr *E,
                                       CXIdxEntityRefKind Kind) {
-  if (!D)
+  if (!D || !DC)
     return false;
   CXCursor Cursor = E ? MakeCXCursor(E, cast<Decl>(DC), CXTU)
@@ -907,7 +907,7 @@
   if (!CB.indexEntityReference)
     return false;
-  if (!D)
+  if (!D || !DC)
     return false;
   if (Loc.isInvalid())
     return false;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41575.128145.patch
Type: text/x-patch
Size: 680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171225/e5ec5b92/attachment.bin>

More information about the cfe-commits mailing list