@@ -811,7 +811,7 @@ void ClangdServer::locateSymbolAt(PathRef File, Position Pos,
811811}
812812
813813void ClangdServer::findAST (SearchASTArgs const &Args,
814- Callback<std::vector<std::vector<ASTNode>> > CB) {
814+ Callback<BoundASTNodes > CB) {
815815 auto Action =
816816 [Args, CB = std::move (CB)](llvm::Expected<InputsAndAST> InpAST) mutable {
817817 if (!InpAST)
@@ -824,19 +824,17 @@ void ClangdServer::findAST(SearchASTArgs const &Args,
824824
825825 auto &&AST = InpAST->AST ;
826826 // Convert BoundNodes to a vector of vectors to ASTNode's.
827- std::vector<std::vector<ASTNode>> Result;
827+ BoundASTNodes Result;
828828 Result.reserve (BoundNodes->size ());
829829 for (auto &&BN : *BoundNodes) {
830830 auto &&Map = BN.getMap ();
831- std::vector<ASTNode> Nodes;
832- Nodes.reserve (Map.size ());
831+ BoundASTNodes::value_type BAN;
833832 for (const auto &[Key, Value] : Map) {
834- auto Node = dumpAST (Value, AST.getTokens (), AST.getASTContext ());
835- Nodes.push_back (std::move (Node));
833+ BAN.emplace (Key, dumpAST (Value, AST.getTokens (), AST.getASTContext ()));
836834 }
837- if (Nodes .empty ())
835+ if (BAN .empty ())
838836 continue ;
839- Result.push_back (std::move (Nodes ));
837+ Result.push_back (std::move (BAN ));
840838 }
841839 if (Result.empty ()) {
842840 return CB (error (" No AST nodes found for the query" ));
0 commit comments