[PATCH] D41102: Setup clang-doc frontend framework

Julie Hockett via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 13 11:28:00 PST 2017


juliehockett added inline comments.


================
Comment at: tools/clang-doc/ClangDocReporter.cpp:228
+  for (comments::Comment *Child :
+       llvm::make_range(C->child_begin(), C->child_end())) {
+    CommentInfo ChildCI;
----------------
JonasToth wrote:
> Extract range into utility method of `Comment`
See above -- `comments::Comment` is a clang type that stores all the information about a particular piece of a comment -- the `CommentInfo` struct is specific to the clang-doc setup. Is that what you're thinking about?


================
Comment at: tools/clang-doc/ClangDocReporter.h:51
+  llvm::SmallVector<int, 8> Position;
+  std::vector<CommentInfo> Children;
+};
----------------
JonasToth wrote:
> Here a short `children()` method return llvm::make_range shortens the code in a later loop and might benefit in the future for iterations over children.
Is there a reason you wouldn't be able to just use `for (const CommentInfo &c : CI.Children)` ? The later loop I believe you're referencing doesn't loop over this struct, it looks at the children of a `comments::Comment` type.


https://reviews.llvm.org/D41102





More information about the cfe-commits mailing list