================ @@ -866,11 +878,15 @@ genHTML(const RecordInfo &I, Index &InfoIndex, const ClangDocContext &CDCtx, Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_H1, InfoTitle)); if (I.DefLoc) { - if (!CDCtx.RepositoryUrl) - Out.emplace_back(writeFileDefinition(*I.DefLoc)); - else - Out.emplace_back(writeFileDefinition( - *I.DefLoc, StringRef{*CDCtx.RepositoryUrl})); + std::optional<StringRef> RepoUrl; + std::optional<StringRef> RepoLinePrefix; + + if (CDCtx.RepositoryUrl) + RepoUrl = StringRef{*CDCtx.RepositoryUrl}; + if (CDCtx.RepositoryLinePrefix) + RepoLinePrefix = StringRef{*CDCtx.RepositoryLinePrefix}; + + Out.emplace_back(writeFileDefinition(*I.DefLoc, RepoUrl, RepoLinePrefix)); ---------------- hulxv wrote:
I thought about that too. We can make a helper function that takes `Location` and `CDCtx` and makes this repeated operation. https://github.com/llvm/llvm-project/pull/131280 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits