[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-05-09 Thread Kadir Cetinkaya via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rCTE360344: [clangd] Count number of references while merging RefSlabs inside FileIndex (authored by kadircet, committed by ). Changed prior to commit: https://reviews.llvm.org/D59481?vs=198816&id=198818#

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-05-09 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 198816. kadircet marked 2 inline comments as done. kadircet added a comment. - Address comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59481/new/ https://reviews.llvm.org/D59481 Files: clang-tools-ex

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-05-09 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision. ilya-biryukov added a comment. This revision is now accepted and ready to land. LGTM Comment at: clang-tools-extra/clangd/index/FileIndex.cpp:101 FileToRefs.erase(Path); - else -FileToRefs[Path] = std::move(Refs); + else { +R

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-05-09 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 198770. kadircet marked 7 inline comments as done. kadircet added a comment. - Address comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59481/new/ https://reviews.llvm.org/D59481 Files: clang-tools-ex

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-05-08 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clang-tools-extra/clangd/index/Background.cpp:482 FileDigest Digest; +bool IsMainFile; }; NIT: maybe initialize with `=false` to avoid potential UB. `Digest` seems uninitialized too, could also `={}` fo

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-04-30 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 197288. kadircet added a comment. - Change logic to count references from only main files Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59481/new/ https://reviews.llvm.org/D59481 Files: clang-tools-extra/cl

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-04-29 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clang-tools-extra/clangd/index/Background.h:113 + // Note that FileSymbols counts References by incrementing it per each file + // mentioning the symbol, including headers. This contradicts with the kadircet wr

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-04-25 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet marked 2 inline comments as done. kadircet added a comment. It has been a long time since I've proposed that change and even I forgot some of the high level details. Therefore, I wanted to sum up the state again so that we can decide on how to move forward. Currently we have two differ

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-04-25 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clang-tools-extra/clangd/index/Background.h:113 + // Note that FileSymbols counts References by incrementing it per each file + // mentioning the symbol, including headers. This contradicts with the We should a

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-03-22 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments. Comment at: clang-tools-extra/clangd/index/FileIndex.cpp:46 +auto It = MergedSyms->find(Sym.first); +assert(It != MergedSyms->end() && "Reference to unknown symbol!"); +// Note that we increment References per each file ment

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-03-22 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 191844. kadircet marked 11 inline comments as done. kadircet added a comment. - Address comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59481/new/ https://reviews.llvm.org/D59481 Files: clang-tools-e

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-03-20 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clang-tools-extra/clangd/index/FileIndex.cpp:170 I.first->second = mergeSymbol(I.first->second, Sym); +// We re-count number of references while merging refs from scratch. +I.first->getSecond().References

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-03-20 Thread Eric Liu via Phabricator via cfe-commits
ioeric added inline comments. Comment at: clang-tools-extra/clangd/index/FileIndex.cpp:33 +// If MergedSyms is provided, increments a symbols Reference count once for +// every file it was mentioned in. +void mergeRefs(llvm::ArrayRef> RefSlabs, nit: s/every file/

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-03-19 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet marked an inline comment as done. kadircet added inline comments. Comment at: clang-tools-extra/clangd/index/FileIndex.cpp:170 I.first->second = mergeSymbol(I.first->second, Sym); +// We re-count number of references while merging refs from scratch. +

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-03-19 Thread Eric Liu via Phabricator via cfe-commits
ioeric added a comment. > I don't follow why this can over-count, FileIndex keeps only one RefSlab per > each file, so we can't over-count? Did you mean it will be more than #TUs ? Yes. This is how `Symbol::References` is described in its documentation. If we want to change/expand the semantic,

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-03-19 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet marked 2 inline comments as done. kadircet added a comment. In D59481#1432881 , @ioeric wrote: > I'm not sure if FileIndex is the correct layer to make decision about how > References is calculated. Currently, we have two use cases in clangd 1) o

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-03-18 Thread Eric Liu via Phabricator via cfe-commits
ioeric added a comment. I'm not sure if FileIndex is the correct layer to make decision about how References is calculated. Currently, we have two use cases in clangd 1) one slab per TU and 2) one slab per file. It seems to me that we would want different strategies for the two use cases, so it

[PATCH] D59481: [clangd] Count number of references while merging RefSlabs inside FileIndex

2019-03-18 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet created this revision. kadircet added a reviewer: ilya-biryukov. Herald added subscribers: cfe-commits, jdoerfert, arphaman, mgrang, jkorous, MaskRay, ioeric. Herald added a project: clang. For counting number of references clangd was relying on merging every duplication of a symbol. Unf