[PATCH] D63857: [clang-doc] Add a structured HTML generator

Jake Ehrlich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 28 15:46:01 PDT 2019


jakehehrlich added inline comments.


================
Comment at: clang-tools-extra/clang-doc/HTMLGenerator.cpp:228
+  Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_H2, "Functions"));
+  Out.emplace_back(llvm::make_unique<TagNode>(HTMLTag::TAG_DIV));
+  for (const auto &F : Functions) {
----------------
Refering to this as `Out.back()` is confusing, can you give it a variable name? It took me longer than I care to admit to figure out that you weren't appending to `Out` in the loop. A pretty common pattern I use is to just assign `back()` to a reference that I'm going to use a lot.

```
Out.emplace_back(...);
auto& DivBody = Out.back();
```

That way you get the inplace construction and you can refer to it wherever you'd like by name.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63857/new/

https://reviews.llvm.org/D63857





More information about the cfe-commits mailing list