[PATCH] D72954: [clang-doc] Improving Markdown Output

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 20:16:19 PST 2020


phosek added inline comments.


================
Comment at: clang-tools-extra/clang-doc/MDGenerator.cpp:280
 
+static void serializeReference(llvm::raw_fd_ostream &OS, Index &I, int level) {
+
----------------
`level` should be `Level`.


================
Comment at: clang-tools-extra/clang-doc/MDGenerator.cpp:281
+static void serializeReference(llvm::raw_fd_ostream &OS, Index &I, int level) {
+
+  // Write out the heading level starting at ##
----------------
Nit: no extra empty line.


================
Comment at: clang-tools-extra/clang-doc/MDGenerator.cpp:295
+  llvm::raw_fd_ostream OS(FilePath, FileErr, llvm::sys::fs::OF_None);
+  if (FileErr != OK) {
+    return llvm::createStringError(llvm::inconvertibleErrorCode(),
----------------
No need for `OK`, you can simply do `if (FileErr)`.


================
Comment at: clang-tools-extra/clang-doc/MDGenerator.cpp:299
+                                       FileErr.message());
+  }
+  CDCtx.Idx.sort();
----------------
No curly braces for blocks with a single statement according to LLVM style.


================
Comment at: clang-tools-extra/clang-doc/MDGenerator.cpp:304
+    OS << " for " << CDCtx.ProjectName;
+  }
+  OS << "\n\n";
----------------
The same here, no curly braces for blocks with a single statement according to LLVM style.


================
Comment at: clang-tools-extra/clang-doc/MDGenerator.cpp:309
+    serializeReference(OS, C, 0);
+  }
+  return llvm::Error::success();
----------------
Here as well.


================
Comment at: clang-tools-extra/clang-doc/MDGenerator.cpp:320
+  llvm::raw_fd_ostream OS(FilePath, FileErr, llvm::sys::fs::OF_None);
+  if (FileErr != OK) {
+    return llvm::createStringError(llvm::inconvertibleErrorCode(),
----------------
The same here, both the error checking and curly braces.


================
Comment at: clang-tools-extra/clang-doc/Representation.cpp:124
+    // iterate back to the top
+    for (llvm::sys::path::const_iterator iter =
+             llvm::sys::path::begin(CurrentPath);
----------------
`iter` should be `Iter` (or just `I`) according to LLVM style.


================
Comment at: clang-tools-extra/clang-doc/Representation.cpp:134
+  // the file is actually in the subdirectory for the namespace.
+  if (Type == doc::InfoType::IT_namespace) {
+    llvm::sys::path::append(FilePath, Name);
----------------
No curly braces for blocks with a single statement.


================
Comment at: clang-tools-extra/clang-doc/Representation.cpp:146
+llvm::SmallString<16> Reference::getFileBaseName() const {
+  if (RefType == InfoType::IT_namespace) {
+    return llvm::SmallString<16>("index");
----------------
No curly braces for blocks with a single statement.


================
Comment at: clang-tools-extra/clang-doc/Representation.cpp:159
+llvm::SmallString<16> Info::getFileBaseName() const {
+  if (IT == InfoType::IT_namespace) {
+    return llvm::SmallString<16>("index");
----------------
No curly braces for blocks with a single statement.


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

https://reviews.llvm.org/D72954





More information about the llvm-commits mailing list