[clang-tools-extra] [clang-doc] [feat] add --repository-line-prefix argument (PR #131280)
Mohamed Emad via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 17 13:17:32 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));
----------------
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
More information about the cfe-commits
mailing list