This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Change constness of parameters to findExplicitRefs
ClosedPublic

Authored by kadircet on Sep 25 2019, 7:35 AM.

Details

Summary

Recursive AST requires non-const ast nodes, but it doesn't really
mutate them. In addition to that, in clangd we mostly have const ast nodes. So
it makes sense to move the const_cast into callee rather than having it at every
caller in the future.

Diff Detail

Repository
rL LLVM

Event Timeline

kadircet created this revision.Sep 25 2019, 7:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 25 2019, 7:35 AM

Who are the callers? Selection tree?
FWIW, I'd rather pass non-const everywhere, the concept of const-ness is just not very useful for AST nodes.

ilya-biryukov accepted this revision.Sep 25 2019, 8:36 AM

@kadircet says we're using this pattern all over clangd. This somehow slipped my view before.
LGTM to be consistent with the rest of clangd (and functions in FindTarget.h).

I think we should switch to passing non-const pointers everywhere, but that's a discussion for another day...

This revision is now accepted and ready to land.Sep 25 2019, 8:36 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 25 2019, 8:43 AM