This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Allow renaming class templates in cross-file rename.
ClosedPublic

Authored by hokein on Feb 17 2020, 5:50 AM.

Details

Summary

It was disabled because we don't handle explicit template
specialization well (due to the index limitation).

renaming templates is normal in practic, rather than disabling it, this patch
allows to rename them though it is not perfect (just a known limitation).

Context: https://github.com/clangd/clangd/issues/280

Diff Detail

Event Timeline

hokein created this revision.Feb 17 2020, 5:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 17 2020, 5:50 AM

I think we might still give a warning of some sort that this is known to produce results that are not always correct. Otherwise it might feel like a bug/unknown behavior.

I think we might still give a warning of some sort that this is known to produce results that are not always correct. Otherwise it might feel like a bug/unknown behavior.

I agree that it would be nice to give a warning. Unfortunately, LSP specification doesn't have such things, returning either a workspaceEdits or an error message, but not both. I think it is still make sense to enable it, I'd say this is a known limitation (this will be mentioned in the user-facing document which I'm working on).

I also test it with llvm::Optional, it works (except the same issue of the tablegen files .inc).

kbobyrev accepted this revision.Feb 20 2020, 7:02 AM

Okay, that is unfortunate, but I think trying to rename these classes with some inaccuracy is better than failing right away.

This revision is now accepted and ready to land.Feb 20 2020, 7:02 AM
This revision was automatically updated to reflect the committed changes.