r337394 - [CodeComplete] Allow getDeclaration on RK_Pattern result.
Eric Liu via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 18 08:17:52 PDT 2018
Author: ioeric
Date: Wed Jul 18 08:17:52 2018
New Revision: 337394
URL: http://llvm.org/viewvc/llvm-project?rev=337394&view=rev
Log:
[CodeComplete] Allow getDeclaration on RK_Pattern result.
Summary:
RK_Pattern results can also have associated declarations e.g. field
decls in constructor initializers.
Reviewers: bkramer
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D49484
Modified:
cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h
Modified: cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h?rev=337394&r1=337393&r2=337394&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h (original)
+++ cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h Wed Jul 18 08:17:52 2018
@@ -895,9 +895,11 @@ public:
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;
}
More information about the cfe-commits
mailing list