15 Commits

Author SHA1 Message Date
timon-ul
7de0da40c0
[clangd] Support invoking call hierarchy on enum constants (#147042)
Fixes https://github.com/clangd/clangd/issues/2203
2025-08-03 00:18:47 -04:00
Hampus Adolfsson
bea110db3e
[clangd] Strip invalid fromRanges for outgoing calls (#134657)
`CallHierarchyOutgoingCall::fromRanges` are interpreted as ranges in the
same file as the item for which 'outgoingCalls' was called.

It's possible for outgoing calls to be in a different file than that
item if the item is just a declaration (e.g. in a header file). Now,
such calls are dropped instead of being returned to the client.

This is the same as the change made in #111616, but now for outgoing
calls.

Fixes clangd/clangd#2350

---------

Co-authored-by: Nathan Ridge <zeratul976@hotmail.com>
2025-04-24 03:28:35 -04:00
Nathan Ridge
61fe67a401
[clangd] support outgoing calls in call hierarchy (#117673)
This reverts commit ce0f11325e0c62c5b81391589e9b93b412a85bc1.
2024-12-05 10:10:42 +01:00
Augie Fackler
ce0f11325e Revert "[clangd] Re-land "support outgoing calls in call hierarchy" (#117673)"
This reverts commit 7be3326200ef382705d8e6b2d7dc5378af96b34a.

Per https://protobuf.dev/programming-guides/dos-donts/#add-required
this will re-land tomorrow without the required fields.
2024-12-04 15:58:56 -05:00
Nathan Ridge
7be3326200
[clangd] Re-land "support outgoing calls in call hierarchy" (#117673)
Co-authored-by: Quentin Chateau <quentin.chateau@gmail.com>
2024-12-04 01:07:57 -05:00
Nathan Ridge
d77cab823f
Revert "[clangd] Support outgoing calls in call hierarchy (#77556)" (#117668)
This reverts commit ca184cfc088a843e545e5f04b48813e6f9bfba77.
2024-11-26 00:08:33 -05:00
Nathan Ridge
ca184cfc08
[clangd] Support outgoing calls in call hierarchy (#77556)
Co-authored-by: Quentin Chateau <quentin.chateau@gmail.com>
2024-11-25 23:58:33 -05:00
Nathan Ridge
545917cb4b
[clangd] Harden incomingCalls() against possible misinterpretation of a range as pertaining to the wrong file (#111616)
`CallHierarchyIncomingCall::fromRanges` are interpreted as ranges in the
same file as the `CallHierarchyItem` representing the caller
(`CallHierarchyIncomingCall::from`).

In C/C++, it's possible for the calls to be in a different file than the caller,
as illustrated in the added test case.

With this patch, such calls are dropped, rather than their ranges being
incorrectly interpreted as pertaining to the wrong file.
2024-11-19 01:32:04 -05:00
timon-ul
e102338b6e
Support call hierarchy for fields and non-local variables (#113900)
Fixes https://github.com/clangd/clangd/issues/1308
2024-11-03 01:38:25 -05:00
Sam McCall
4d006520b8 [clangd] Clean up unused includes. NFCI
Add includes where needed to fix build.
Haven't systematically added used headers, so there is still accidental
dependency on transitive includes.
2022-02-26 12:00:16 +01:00
Christian Kühnel
8edfc2f814 [clangd] Cleanup of readability-identifier-naming
Auto-generated patch based on clang-tidy readability-identifier-naming.
Only some manual cleanup for `extern "C"` declarations and a GTest change was required.

I'm not sure if this cleanup is actually very useful. It cleans up clang-tidy findings to the number of warnings from clang-tidy should be lower.  Since it was easy to do and required only little cleanup I thought I'd upload it for discussion.

One pattern that keeps recurring: Test **matchers** are also supposed to start with a lowercase letter as per LLVM convention. However GTest naming convention for matchers start with upper case. I would propose to keep stay consistent with the GTest convention there. However that would imply a lot of `//NOLINT` throughout these files.

To re-product this patch run:
```
run-clang-tidy -checks="-*,readability-identifier-naming" -fix -format ./clang-tools-extra/clangd
```

To convert the macro names, I was using this script with some manual cleanup afterwards:
https://gist.github.com/ChristianKuehnel/a01cc4362b07c58281554ab46235a077

Differential Revision: https://reviews.llvm.org/D115634
2022-02-01 13:31:52 +00:00
Sheldon Neuberger
e2cad4df22
[clangd] Add ObjC method support to prepareCallHierarchy
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. We change to use isFunctionOrMethod which includes functions and ObjC methods.

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D114058
2021-11-25 11:23:24 +01:00
Nathan Ridge
f443793d26 [clangd] Ensure Ref::Container refers to an indexed symbol
Fixes https://github.com/clangd/clangd/issues/806

Differential Revision: https://reviews.llvm.org/D105083
2021-07-22 03:33:40 -04:00
Nathan Ridge
5b6f47595b [clangd] Sort results of incomingCalls request by container name
Differential Revision: https://reviews.llvm.org/D92009
2020-11-24 03:29:02 -05:00
Nathan Ridge
3e6e6a2db6 [clangd] Call hierarchy (XRefs layer, incoming calls)
Support for outgoing calls is left for a future change.

Differential Revision: https://reviews.llvm.org/D91122
2020-11-23 20:43:38 -05:00