[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:44 PDT 2025
================
@@ -57,7 +57,12 @@ 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)
+ OS << "*Defined at [" << L.Filename << "#";
+
+ if (!CDCtx.RepositoryLinePrefix)
+ OS << StringRef{*CDCtx.RepositoryLinePrefix};
+
+ OS << std::to_string(L.LineNumber)
----------------
ilovepi wrote:
```suggestion
OS << "*Defined at [" << L.Filename << "#"
<< CDCtx.RepositoryLinePrefix.value_or("")
<< std::to_string(L.LineNumber)
```
Perhaps something like this? In any case, there isn't a need to convert the `optional<string>` into a `StringRef` here over just using the string value.
https://github.com/llvm/llvm-project/pull/131280
More information about the cfe-commits
mailing list