This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Ignore more implicit nodes in computing selection.
ClosedPublic

Authored by sammccall on Nov 13 2019, 11:17 AM.

Details

Summary

The DeclRefExpr for the callee of overloaded operator() and operator[] are
assigned the range of the paren/bracket lists in the AST.
These are better thought of as implicit (at least () - `[] is murkier).
But there's no bit on Expr for implicit, so just ignore them on our side.

While here, deal with the case where an implicit stmt (e.g. implicit-this)
is wrapped in an implicit cast. Previously we ignored the statement but not
the cast, and so the cast ended up being selected.

Fixes https://github.com/clangd/clangd/issues/195

Diff Detail

Event Timeline

sammccall created this revision.Nov 13 2019, 11:17 AM

Build result: pass - 59972 tests passed, 0 failed and 763 were skipped.
Log files: console-log.txt, CMakeCache.txt

kadircet accepted this revision.Nov 14 2019, 12:05 AM

LGTM, thanks!

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

nit: braces

163

nit: braces

This revision is now accepted and ready to land.Nov 14 2019, 12:05 AM
This revision was automatically updated to reflect the committed changes.