[PATCH] D114058: [clang] Add ObjC decls to Decl::isFunctionOrFunctionTemplate
Sheldon Neuberger via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 16 23:24:30 PST 2021
sheldonneuberger-sc created this revision.
sheldonneuberger-sc added a reviewer: nridge.
Herald added subscribers: usaxena95, kadircet.
sheldonneuberger-sc added a reviewer: erichkeane.
sheldonneuberger-sc edited the summary of this revision.
sheldonneuberger-sc published this revision for review.
Herald added subscribers: cfe-commits, ilya-biryukov.
Herald added a project: clang.
This fixes "textDocument/prepareCallHierarchy" in clangd for ObjC methods. Details at https://github.com/clangd/vscode-clangd/issues/247.
clangd uses Decl::isFunctionOrFunctionTemplate to check if the decl given in a prepareCallHierarchy request is eligible for prepareCallHierarchy, so we want it to return true for ObjC methods too. I added Block, Captured, and ObjCMethod because that's what was also done in DeclContext::isFunctionOrMethod.
Need guidance on if the function should be renamed to isFunctionOrMethodOrFunctionTemplate.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D114058
Files:
clang/include/clang/AST/DeclBase.h
Index: clang/include/clang/AST/DeclBase.h
===================================================================
--- clang/include/clang/AST/DeclBase.h
+++ clang/include/clang/AST/DeclBase.h
@@ -1040,9 +1040,15 @@
/// Whether this declaration is a function or function template.
bool isFunctionOrFunctionTemplate() const {
- return (DeclKind >= Decl::firstFunction &&
- DeclKind <= Decl::lastFunction) ||
- DeclKind == FunctionTemplate;
+ switch (DeclKind) {
+ case Decl::Block:
+ case Decl::Captured:
+ case Decl::ObjCMethod:
+ case Decl::FunctionTemplate:
+ return true;
+ default:
+ return DeclKind >= Decl::firstFunction && DeclKind <= Decl::lastFunction;
+ }
}
/// If this is a declaration that describes some template, this
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114058.387833.patch
Type: text/x-patch
Size: 798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211117/c81db464/attachment.bin>
More information about the cfe-commits
mailing list