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

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 25 15:53:54 PST 2017


MaskRay updated this revision to Diff 128150.
MaskRay added a comment.

Sorry for changing this back and forth. But I do not have a powerful workstation and have to reverse engineer this.


Repository:
  rC Clang

https://reviews.llvm.org/D41575

Files:
  tools/libclang/CXIndexDataConsumer.cpp


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.128150.patch
Type: text/x-patch
Size: 680 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171225/ae77753d/attachment.bin>


More information about the cfe-commits mailing list