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
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
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits