[all-commits] [llvm/llvm-project] decdbc: [clangd] Use expansion location when the ref is in...

Haojian Wu via All-commits all-commits at lists.llvm.org
Mon Dec 9 07:36:14 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: decdbc1155f5120554269319b1c77675bac9151c
      https://github.com/llvm/llvm-project/commit/decdbc1155f5120554269319b1c77675bac9151c
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2019-12-09 (Mon, 09 Dec 2019)

  Changed paths:
    M clang-tools-extra/clangd/index/SymbolCollector.cpp
    M clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
    M clang-tools-extra/clangd/unittests/XRefsTests.cpp

  Log Message:
  -----------
  [clangd] Use expansion location when the ref is inside macros.

Summary:
Previously, xrefs has inconsistent behavior when the reference is inside
macro body:
- AST-based xrefs (for main file) uses the expansion location;
- our index uses the spelling location;

This patch makes our index use file locations for references, which is
consistent with AST-based xrefs, and kythe as well.

After this patch, memory usage of static index on LLVM increases ~5%.

Reviewers: ilya-biryukov

Subscribers: merge_guards_bot, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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




More information about the All-commits mailing list