[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
Loading
Please sign in to comment