[clang-tools-extra] [clang-doc] Serialize record files with mangled name (PR #148021)

Paul Kirth via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 10 12:46:03 PDT 2025


================
@@ -501,15 +502,26 @@ Error JSONGenerator::generateDocs(
 
     SmallString<128> Path;
     sys::path::native(RootDir, Path);
-    sys::path::append(Path, Info->getRelativeFilePath(""));
     if (!CreatedDirs.contains(Path)) {
       if (std::error_code Err = sys::fs::create_directories(Path);
           Err != std::error_code())
         return createFileError(Twine(Path), Err);
       CreatedDirs.insert(Path);
     }
 
-    sys::path::append(Path, Info->getFileBaseName() + ".json");
+    SmallString<16> FileName;
+    if (Info->IT == InfoType::IT_record) {
----------------
ilovepi wrote:

Maybe this would be nicer as a helper function?  I'm not convinced either way, since its only used once, but I'd consider abstracting out that much logic into something like  `StringRef generateFileName(Info*)`.

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


More information about the cfe-commits mailing list