[all-commits] [llvm/llvm-project] bbcbb1: [clangd] Ignore more implicit nodes in computing s...

Sam McCall via All-commits all-commits at lists.llvm.org
Thu Nov 14 08:41:03 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: bbcbb10e2d0848b611c51b1ff56c758645c55f3b
      https://github.com/llvm/llvm-project/commit/bbcbb10e2d0848b611c51b1ff56c758645c55f3b
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2019-11-14 (Thu, 14 Nov 2019)

  Changed paths:
    M clang-tools-extra/clangd/Selection.cpp
    M clang-tools-extra/clangd/unittests/SelectionTests.cpp

  Log Message:
  -----------
  [clangd] Ignore more implicit nodes in computing selection.

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

Reviewers: kadircet, lh123

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70194




More information about the All-commits mailing list