[clang-tools-extra] [clang-doc] [feat] add --repository-line-prefix argument (PR #131280)
Mohamed Emad via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 22 12:56:55 PDT 2025
================
@@ -57,11 +58,13 @@ static void writeFileDefinition(const ClangDocContext &CDCtx, const Location &L,
OS << "*Defined at " << L.Filename << "#" << std::to_string(L.LineNumber)
<< "*";
} else {
- OS << "*Defined at [" << L.Filename << "#" << std::to_string(L.LineNumber)
- << "](" << StringRef{*CDCtx.RepositoryUrl}
- << llvm::sys::path::relative_path(L.Filename) << "#"
- << std::to_string(L.LineNumber) << ")"
- << "*";
+
+ std::string LineAnchor =
+ formatv("#{0}{1}", CDCtx.RepositoryLinePrefix.value_or(""),
+ std::to_string(L.LineNumber));
+
+ OS << formatv("*Defined at [{0}{1}]({0}{2})*", LineAnchor, L.Filename,
+ StringRef{*CDCtx.RepositoryUrl});
----------------
hulxv wrote:
https://github.com/llvm/llvm-project/pull/131280#discussion_r2008862784
The same thing, it's more readable
https://github.com/llvm/llvm-project/pull/131280
More information about the cfe-commits
mailing list