[all-commits] [llvm/llvm-project] ad9fd3: [clangd] Fix SelectionTree behavior on constructor...

Sam McCall via All-commits all-commits at lists.llvm.org
Fri Nov 15 08:32:24 PST 2019


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

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

  Log Message:
  -----------
  [clangd] Fix SelectionTree behavior on constructor init-lists.

Summary:
For the constructor Foo() : classmember(arg) {}

The AST looks like:
 - CXXCtorInitializer  classmember(arg)
   - CXXConstructExpr  classmember(arg)
     - DeclRefExpr:                arg

We want the 'classmember' to be associated with the CXXCtorInitializer, not the
CXXConstructExpr. (CXXConstructExpr is known to have bad ranges).
So just early-claim it.

Thanks @hokein for tracking down/reducing the bug.

Reviewers: hokein

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

Tags: #clang

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




More information about the All-commits mailing list