[clang-tools-extra] [clang-doc] Add --asset option to clang-doc (PR #94717)
Paul Kirth via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 7 17:01:15 PDT 2024
================
@@ -131,12 +137,55 @@ std::string GetExecutablePath(const char *Argv0, void *MainAddr) {
return llvm::sys::fs::getMainExecutable(Argv0, MainAddr);
}
+void GetAssetFiles(clang::doc::ClangDocContext &CDCtx) {
+ std::error_code Code;
+ for (auto DirIt = llvm::sys::fs::directory_iterator(
+ std::string(UserAssetPath), Code),
+ dir_end = llvm::sys::fs::directory_iterator();
----------------
ilovepi wrote:
I'm not sure this is resolved. I was expecting to see an initialization pattern, similar to the code example I linked, which is much more typical in our codebase. We also have a somewhat mixed policy on the use of `auto` (https://www.llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable). Typically, is more readable to use it in a for loop, or for initializing an iterator, but I'm always hesitant when `auto` is used for multiple initializations.
```c++
for (llvm::sys::fs::directory_iterator DirIt = llvm::sys::fs::directory_iterator(
UserAssetPath, Code), DirEnd; ...
```
A using statement may also make this easier to read.
https://github.com/llvm/llvm-project/pull/94717
More information about the cfe-commits
mailing list