This is an archive of the discontinued LLVM Phabricator instance.

[clangd] consider ~^foo() to target the destructor, not the type
ClosedPublic

Authored by sammccall on Oct 18 2022, 4:42 PM.

Details

Summary

This behavior was once deliberate, but i've yet to find someone who likes it.
The reference behavior is unchanged: the foo within ~foo is still considered
a reference to the type. This means rename etc still works.

fixes https://github.com/clangd/clangd/issues/179

Diff Detail

Event Timeline

sammccall created this revision.Oct 18 2022, 4:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 18 2022, 4:42 PM
sammccall requested review of this revision.Oct 18 2022, 4:42 PM
nridge accepted this revision.Oct 18 2022, 10:38 PM

Thanks for fixing!

clang-tools-extra/clangd/Selection.cpp
881

Doesn't N.get<MemberExpr> already return a MemberExpr*?

884

remove log

clang-tools-extra/clangd/unittests/SelectionTests.cpp
469

The FIXME looks like it pertains to the next line where the behaviour is unchanged -- should it be preserved?

This revision is now accepted and ready to land.Oct 18 2022, 10:38 PM
sammccall marked 3 inline comments as done.Oct 19 2022, 5:12 AM

Ugh, sorry for the sloppiness, think I was tired.

clang-tools-extra/clangd/unittests/SelectionTests.cpp
469

I'm pretty sure the reason for the FIXME was to consistently handle type names within constructors/destructors as referencing the type - with this patch we're (hopefully) consistent in the other direction instead.

(I think I probably wrote this comment, I wish I'd included more context)

This revision was automatically updated to reflect the committed changes.
sammccall marked an inline comment as done.