[PATCH] D49484: [CodeComplete] Allow getDeclaration on RK_Pattern result.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 18 07:20:42 PDT 2018


ioeric created this revision.
ioeric added a reviewer: bkramer.
Herald added a subscriber: cfe-commits.

RK_Pattern results can also have associated declarations e.g. field
decls in constructor initializers.


Repository:
  rC Clang

https://reviews.llvm.org/D49484

Files:
  include/clang/Sema/CodeCompleteConsumer.h


Index: include/clang/Sema/CodeCompleteConsumer.h
===================================================================
--- include/clang/Sema/CodeCompleteConsumer.h
+++ include/clang/Sema/CodeCompleteConsumer.h
@@ -895,9 +895,11 @@
     computeCursorKindAndAvailability();
   }
 
-  /// Retrieve the declaration stored in this result.
+  /// Retrieve the declaration stored in this result. This might be nullptr if
+  /// Kind is RK_Pattern.
   const NamedDecl *getDeclaration() const {
-    assert(Kind == RK_Declaration && "Not a declaration result");
+    assert(((Kind == RK_Declaration) || (Kind == RK_Pattern)) &&
+           "Not a declaration or pattern result");
     return Declaration;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49484.156069.patch
Type: text/x-patch
Size: 702 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180718/a11aba8f/attachment.bin>


More information about the cfe-commits mailing list