sammccall accepted this revision. sammccall added inline comments. This revision is now accepted and ready to land.
================ Comment at: clang-tools-extra/clangd/Selection.cpp:361 return nullptr; for (const Node *Ancestor = Root;; Ancestor = Ancestor->Children.front()) { + assert(Ancestor && "Ancestor can not be null"); ---------------- can we just rewrite this as ``` while (Root->Children.size() == 1 && !Root->Selected) Ancestor = Ancestor->Children.front(); return Root; ``` seems a lot clearer, not sure what I was thinking when I wrote this... ================ Comment at: clang-tools-extra/clangd/Selection.cpp:368 } - return nullptr; + llvm_unreachable("must not reach here!"); } ---------------- there's no termination condition for the loop. If there were, the compiler would warn us. I think we don't need this. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64556/new/ https://reviews.llvm.org/D64556 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits