[all-commits] [llvm/llvm-project] a69f9a: [clangd] Fix Origin and MainFileOnly-ness for macros

kadir çetinkaya via All-commits all-commits at lists.llvm.org
Wed Jul 22 02:24:52 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: a69f9a8584f2a090b5fe6235a112f9b68c324863
      https://github.com/llvm/llvm-project/commit/a69f9a8584f2a090b5fe6235a112f9b68c324863
  Author: Kadir Cetinkaya <kadircet at google.com>
  Date:   2020-07-22 (Wed, 22 Jul 2020)

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

  Log Message:
  -----------
  [clangd] Fix Origin and MainFileOnly-ness for macros

Summary:
This was resulting in macros coming from preambles vanishing when user
have opened the source header. For example:

```
// test.h:
 #define X
```

and

```
// test.cc
 #include "test.h
^
```

If user only opens test.cc, we'll get `X` as a completion candidate,
since it is indexed as part of the preamble. But if the user opens
test.h afterwards we would index it as part of the main file and lose
the symbol (as new index shard for test.h will override the existing one
in dynamic index).

Also we were not setting origins for macros correctly, this patch also
fixes it.

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

Reviewers: hokein

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

Tags: #clang

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




More information about the All-commits mailing list