[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 14 14:45:02 PDT 2024


================
@@ -127,16 +135,85 @@ std::string getFormatString() {
 // GetMainExecutable (since some platforms don't support taking the
 // address of main, and some platforms can't implement GetMainExecutable
 // without being given the address of a function in the main executable).
-std::string GetExecutablePath(const char *Argv0, void *MainAddr) {
+std::string getExecutablePath(const char *Argv0, void *MainAddr) {
   return llvm::sys::fs::getMainExecutable(Argv0, MainAddr);
 }
 
+llvm::Error getAssetFiles(clang::doc::ClangDocContext &CDCtx) {
+  std::error_code Code;
+  llvm::SmallString<128> FilePath(UserAssetPath);
+  for (DirIterator DirIt = DirIterator(UserAssetPath, Code),
+                   DirEnd = DirIterator();
----------------
ilovepi wrote:

```suggestion
                   DirEnd;
```
This doesn't need to be initialized that way, and appears to be the common pattern in clang and elsewhere when using directory_iterator. I'm fine w/ using the iterator from VFS, but usage should probably be consistent w/ what's used in other clang-tools-extra projects. If nothing else, there's an argument for being consistent w/ clang.

https://github.com/llvm/llvm-project/pull/94717


More information about the cfe-commits mailing list