[clang-tools-extra] [clang-doc] [feat] add --repository-line-prefix argument (PR #131280)
Paul Kirth via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 17 10:08:42 PDT 2025
================
@@ -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));
----------------
ilovepi wrote:
Even if we don't refactor this code, given that this is the 3rd instance of this same block, we should probably factor this logic out into a helper function.
https://github.com/llvm/llvm-project/pull/131280
More information about the cfe-commits
mailing list