[PATCH] D41102: Setup clang-doc frontend framework

Jake Ehrlich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 30 23:18:30 PST 2018


jakehehrlich added inline comments.


================
Comment at: tools/clang-doc/ClangDocReporter.cpp:53-54
+  if (Pair == Docs.Namespaces.end()) {
+    std::unique_ptr<NamespaceInfo> I = make_unique<NamespaceInfo>();
+    Docs.Namespaces[Name] = std::move(I);
+    populateBasicInfo(*Docs.Namespaces[Name], Name, D->getNameAsString(),
----------------
There's no need for I here, also use llvm::make_unique


================
Comment at: tools/clang-doc/ClangDocReporter.h:133
+
+  void createNamespaceInfo(const NamespaceDecl *D, const FullComment *C,
+                           int LineNumber, StringRef File);
----------------
I think you should use explicit template specialization to make these "createFooInfo" methods uniform. This will enable other code that calls these methods to be written in a more uniform fashion.

so define something like

```
template<class T>
void createInfo(const T *D, const FullComment *C, ...);
```
 
and then define various specializations of that member function instead of creating a new method for each createFooInfo method.


https://reviews.llvm.org/D41102





More information about the cfe-commits mailing list