[PATCH] D34269: [clangd] Add "Go to Declaration" functionality

Marc-Andre Laperle via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 21 12:52:05 PDT 2017


malaperle-ericsson added inline comments.


================
Comment at: clangd/ClangdUnit.cpp:276
+class DeclarationLocationsFinder : public index::IndexDataConsumer {
+  std::unique_ptr<std::vector<Location>> DeclarationLocations;
+  const SourceLocation &SearchedLocation;
----------------
malaperle-ericsson wrote:
> ilya-biryukov wrote:
> > Why do we need to use `unique_ptr<vector<Location>>` here and in other places instead of `vector<Location>`? 
> It was to implement "takeLocations". Calling it claims ownship of the vector. Did you have something else in mind when you suggested to implement takeLocations with a std::move? Disclaimer: this c++11 stuff is all new to me so I wouldn't be surprised if I'm doing it in a terrible way.
I guess I can make takeLocations return a vector&& and the other places will return a normal vector RVO will take care of not making copies?


https://reviews.llvm.org/D34269





More information about the cfe-commits mailing list