================ @@ -406,8 +406,26 @@ static json::Value extractValue(const RecordInfo &I, static Error setupTemplateValue(const ClangDocContext &CDCtx, json::Value &V, Info *I) { - return createStringError(inconvertibleErrorCode(), - "setupTemplateValue is unimplemented"); + V.getAsObject()->insert({"ProjectName", CDCtx.ProjectName}); + json::Value StylesheetArr = Array(); + auto InfoPath = I->getRelativeFilePath(""); + SmallString<128> RelativePath = computeRelativePath("", InfoPath); + for (const auto &FilePath : CDCtx.UserStylesheets) { + SmallString<128> StylesheetPath = RelativePath; + sys::path::append(StylesheetPath, sys::path::filename(FilePath)); + sys::path::native(StylesheetPath, sys::path::Style::posix); + StylesheetArr.getAsArray()->emplace_back(StylesheetPath); + } ---------------- petrhosek wrote:
We shouldn't be calling `sys::path::native` repeatedly inside the loop. ```suggestion SmallString<128> RelativePath = computeRelativePath("", InfoPath); sys::path::native(RelativePath, sys::path::Style::posix); for (const auto &FilePath : CDCtx.UserStylesheets) { SmallString<128> StylesheetPath = RelativePath; sys::path::append(StylesheetPath, sys::path::filename(FilePath), sys::path::Style::posix); StylesheetArr.getAsArray()->emplace_back(StylesheetPath); } ``` https://github.com/llvm/llvm-project/pull/138064 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits