kadircet added a comment. Thanks! I think it looks good, I've suggested some more simplifications to termination detection. If you can delete the rest I'd like to take a final look at the rest of the details.
================ Comment at: clang-tools-extra/clangd/FindSymbols.cpp:680 + // We'll figure out where the Pragmas.front() should go. + PragmaMarkSymbol P = Pragmas.front(); + Pragmas = Pragmas.drop_front(); ---------------- nit: std::move ================ Comment at: clang-tools-extra/clangd/FindSymbols.cpp:712 + ArrayRef<PragmaMarkSymbol> NextPragmas = Pragmas; + while (true) { + // We own all children that occur after us. ---------------- ``` bool TerminatedByNextPragma = false; for (auto &NextPragma : Pragmas) { // If we hit a pragma outside of Cur, the rest will be outside as well. if (!Cur->contains(NextPragma)) break; // NextPragma cannot terminate P if it is nested inside a children, look for the next one. if (any_of(Cur->children, [](...) { return Child->contains(NextPragma); }) continue; // Pragma owns all the children between P and NextPragma auto It = std::partition(....); P.children.assign(make_move_iterator(It), make_move_iterator(Cur->children.end())); Cur->children.erase(It, ...); TerminatedByNextPragma = true; break; } if(!TerminatedByNextPragma) { // P is terminated by the end of current symbol, hence it owns all the children after P. auto It = std::partition(....); P.children.assign(make_move_iterator(It), make_move_iterator(Cur->children.end())); Cur->children.erase(It, ...); } // Update the range for P to cover children and append to Cur. ``` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D105904/new/ https://reviews.llvm.org/D105904 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits