ilya-biryukov added inline comments.
================ Comment at: clangd/ClangdUnit.cpp:376 + + CompletionItem Item{InsertTextFormat::PlainText}; + ---------------- rwols wrote: > ilya-biryukov wrote: > > Implementations of this function in `PlainTextCompletionItemsCollector` and > > `SnippetCompletionItemsCollector` are the same. > > Maybe make `ProcessChunks` virtual instead? > > > > Or maybe consider replacing inheritance with a `bool` flag. Inheritance > > does not seem to buy us much here. This looks simpler: > > ``` > > if (EnableSnippets) > > ProcessChunksWithSnippets(CCS, Item); > > else > > ProcessChunksWithoutSnippets(CCS, Item); > > > > ``` > > > > > I went with the "make ProcessChunks virtual" approach, wouldn't your > suggestion have an impact on performance? There'd be a check for every > completion item now. Oh, that should not make any difference performance-wise. There is many more branching on each completion item even if we assume all the function calls are inlined. And virtual calls are not free either. https://reviews.llvm.org/D37101 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits