eduucaldas added inline comments.
================ Comment at: clang/include/clang/Tooling/Syntax/Tree.h:172-174 /// Find the first node with a corresponding role. Node *findChild(NodeRole R); + const Node *findChild(NodeRole R) const; ---------------- I think that makes sense, since all the functions used by `findChild` are public anyways. WDYT Dmitri? Now that the API is being used I realize its surface ^^. Perhaps we should pour some thought into that in the future :) ================ Comment at: clang/lib/Tooling/Syntax/Tree.cpp:304-308 + for (const auto *C = FirstChild; C; C = C->getNextSibling()) { + if (C->getRole() == R) + return C; + } + return nullptr; ---------------- Similarly to the const version of `findFirstLeaf`. I think this should work :) Also you could put the definition in `clang/Tooling/Syntax/Tree.h`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D88553/new/ https://reviews.llvm.org/D88553 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits