Skip to content

Commit 515d1ae

Browse files
authored
[clang-doc] Add --repository-line-prefix argument (llvm#131280)
This PR adds a new command-line option that allows users to specify the prefix used for line-based anchors in repository URLs. Different repository interfaces use different formats for line anchors (GitHub uses `#L123`, googlesource uses `rust-lang#123`, etc.). This option enables users to customize the line prefix to match their repository platform without requiring hard-coded values for each service. Fixes llvm#59814
1 parent c8a70f4 commit 515d1ae

File tree

7 files changed

+85
-49
lines changed

7 files changed

+85
-49
lines changed

clang-tools-extra/clang-doc/HTMLGenerator.cpp

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -490,15 +490,15 @@ genReferencesBlock(const std::vector<Reference> &References,
490490
}
491491
return Out;
492492
}
493+
static std::unique_ptr<TagNode> writeSourceFileRef(const ClangDocContext &CDCtx,
494+
const Location &L) {
493495

494-
static std::unique_ptr<TagNode>
495-
writeFileDefinition(const Location &L,
496-
std::optional<StringRef> RepositoryUrl = std::nullopt) {
497-
if (!L.IsFileInRootDir && !RepositoryUrl)
496+
if (!L.IsFileInRootDir && !CDCtx.RepositoryUrl)
498497
return std::make_unique<TagNode>(
499498
HTMLTag::TAG_P, "Defined at line " + std::to_string(L.LineNumber) +
500499
" of file " + L.Filename);
501-
SmallString<128> FileURL(RepositoryUrl.value_or(""));
500+
501+
SmallString<128> FileURL(CDCtx.RepositoryUrl.value_or(""));
502502
llvm::sys::path::append(
503503
FileURL, llvm::sys::path::Style::posix,
504504
// If we're on Windows, the file name will be in the wrong format, and
@@ -516,11 +516,9 @@ writeFileDefinition(const Location &L,
516516
std::make_unique<TagNode>(HTMLTag::TAG_A, std::to_string(L.LineNumber));
517517
// The links to a specific line in the source code use the github /
518518
// googlesource notation so it won't work for all hosting pages.
519-
// FIXME: we probably should have a configuration setting for line number
520-
// rendering in the HTML. For example, GitHub uses #L22, while googlesource
521-
// uses #22 for line numbers.
522519
LocNumberNode->Attributes.emplace_back(
523-
"href", (FileURL + "#" + std::to_string(L.LineNumber)).str());
520+
"href", formatv("{0}#{1}{2}", FileURL,
521+
CDCtx.RepositoryLinePrefix.value_or(""), L.LineNumber));
524522
Node->Children.emplace_back(std::move(LocNumberNode));
525523
Node->Children.emplace_back(std::make_unique<TextNode>(" of file "));
526524
auto LocFileNode = std::make_unique<TagNode>(
@@ -530,6 +528,13 @@ writeFileDefinition(const Location &L,
530528
return Node;
531529
}
532530

531+
static void maybeWriteSourceFileRef(std::vector<std::unique_ptr<TagNode>> &Out,
532+
const ClangDocContext &CDCtx,
533+
const std::optional<Location> &DefLoc) {
534+
if (DefLoc)
535+
Out.emplace_back(writeSourceFileRef(CDCtx, *DefLoc));
536+
}
537+
533538
static std::vector<std::unique_ptr<TagNode>>
534539
genHTML(const Index &Index, StringRef InfoPath, bool IsOutermostList);
535540

@@ -749,13 +754,7 @@ genHTML(const EnumInfo &I, const ClangDocContext &CDCtx) {
749754

750755
Out.emplace_back(std::move(Table));
751756

752-
if (I.DefLoc) {
753-
if (!CDCtx.RepositoryUrl)
754-
Out.emplace_back(writeFileDefinition(*I.DefLoc));
755-
else
756-
Out.emplace_back(
757-
writeFileDefinition(*I.DefLoc, StringRef{*CDCtx.RepositoryUrl}));
758-
}
757+
maybeWriteSourceFileRef(Out, CDCtx, I.DefLoc);
759758

760759
std::string Description;
761760
if (!I.Description.empty())
@@ -798,13 +797,7 @@ genHTML(const FunctionInfo &I, const ClangDocContext &CDCtx,
798797
}
799798
FunctionHeader->Children.emplace_back(std::make_unique<TextNode>(")"));
800799

801-
if (I.DefLoc) {
802-
if (!CDCtx.RepositoryUrl)
803-
Out.emplace_back(writeFileDefinition(*I.DefLoc));
804-
else
805-
Out.emplace_back(writeFileDefinition(
806-
*I.DefLoc, StringRef{*CDCtx.RepositoryUrl}));
807-
}
800+
maybeWriteSourceFileRef(Out, CDCtx, I.DefLoc);
808801

809802
std::string Description;
810803
if (!I.Description.empty())
@@ -865,13 +858,7 @@ genHTML(const RecordInfo &I, Index &InfoIndex, const ClangDocContext &CDCtx,
865858
InfoTitle = (getTagType(I.TagType) + " " + I.Name).str();
866859
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_H1, InfoTitle));
867860

868-
if (I.DefLoc) {
869-
if (!CDCtx.RepositoryUrl)
870-
Out.emplace_back(writeFileDefinition(*I.DefLoc));
871-
else
872-
Out.emplace_back(writeFileDefinition(
873-
*I.DefLoc, StringRef{*CDCtx.RepositoryUrl}));
874-
}
861+
maybeWriteSourceFileRef(Out, CDCtx, I.DefLoc);
875862

876863
std::string Description;
877864
if (!I.Description.empty())

clang-tools-extra/clang-doc/MDGenerator.cpp

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#include "Representation.h"
1111
#include "llvm/ADT/StringRef.h"
1212
#include "llvm/Support/FileSystem.h"
13+
#include "llvm/Support/FormatVariadic.h"
1314
#include "llvm/Support/Path.h"
15+
#include "llvm/Support/raw_ostream.h"
1416
#include <string>
1517

1618
using namespace llvm;
@@ -50,22 +52,28 @@ static void writeHeader(const Twine &Text, unsigned int Num, raw_ostream &OS) {
5052
OS << std::string(Num, '#') + " " + Text << "\n\n";
5153
}
5254

53-
static void writeFileDefinition(const ClangDocContext &CDCtx, const Location &L,
54-
raw_ostream &OS) {
55+
static void writeSourceFileRef(const ClangDocContext &CDCtx, const Location &L,
56+
raw_ostream &OS) {
5557

5658
if (!CDCtx.RepositoryUrl) {
5759
OS << "*Defined at " << L.Filename << "#" << std::to_string(L.LineNumber)
5860
<< "*";
5961
} else {
60-
OS << "*Defined at [" << L.Filename << "#" << std::to_string(L.LineNumber)
61-
<< "](" << StringRef{*CDCtx.RepositoryUrl}
62-
<< llvm::sys::path::relative_path(L.Filename) << "#"
63-
<< std::to_string(L.LineNumber) << ")"
64-
<< "*";
62+
63+
OS << formatv("*Defined at [#{0}{1}{2}](#{0}{1}{3})*",
64+
CDCtx.RepositoryLinePrefix.value_or(""), L.LineNumber,
65+
L.Filename, *CDCtx.RepositoryUrl);
6566
}
6667
OS << "\n\n";
6768
}
6869

70+
static void maybeWriteSourceFileRef(llvm::raw_ostream &OS,
71+
const ClangDocContext &CDCtx,
72+
const std::optional<Location> &DefLoc) {
73+
if (DefLoc)
74+
writeSourceFileRef(CDCtx, *DefLoc, OS);
75+
}
76+
6977
static void writeDescription(const CommentInfo &I, raw_ostream &OS) {
7078
if (I.Kind == "FullComment") {
7179
for (const auto &Child : I.Children)
@@ -142,8 +150,8 @@ static void genMarkdown(const ClangDocContext &CDCtx, const EnumInfo &I,
142150
for (const auto &N : I.Members)
143151
Members << "| " << N.Name << " |\n";
144152
writeLine(Members.str(), OS);
145-
if (I.DefLoc)
146-
writeFileDefinition(CDCtx, *I.DefLoc, OS);
153+
154+
maybeWriteSourceFileRef(OS, CDCtx, I.DefLoc);
147155

148156
for (const auto &C : I.Description)
149157
writeDescription(C, OS);
@@ -170,8 +178,8 @@ static void genMarkdown(const ClangDocContext &CDCtx, const FunctionInfo &I,
170178
writeLine(genItalic(I.ReturnType.Type.QualName + " " + I.Name + "(" +
171179
Stream.str() + ")"),
172180
OS);
173-
if (I.DefLoc)
174-
writeFileDefinition(CDCtx, *I.DefLoc, OS);
181+
182+
maybeWriteSourceFileRef(OS, CDCtx, I.DefLoc);
175183

176184
for (const auto &C : I.Description)
177185
writeDescription(C, OS);
@@ -230,8 +238,8 @@ static void genMarkdown(const ClangDocContext &CDCtx, const NamespaceInfo &I,
230238
static void genMarkdown(const ClangDocContext &CDCtx, const RecordInfo &I,
231239
llvm::raw_ostream &OS) {
232240
writeHeader(getTagType(I.TagType) + " " + I.Name, 1, OS);
233-
if (I.DefLoc)
234-
writeFileDefinition(CDCtx, *I.DefLoc, OS);
241+
242+
maybeWriteSourceFileRef(OS, CDCtx, I.DefLoc);
235243

236244
if (!I.Description.empty()) {
237245
for (const auto &C : I.Description)

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,8 @@ void Index::sort() {
367367
ClangDocContext::ClangDocContext(tooling::ExecutionContext *ECtx,
368368
StringRef ProjectName, bool PublicOnly,
369369
StringRef OutDirectory, StringRef SourceRoot,
370-
StringRef RepositoryUrl, StringRef Base,
370+
StringRef RepositoryUrl,
371+
StringRef RepositoryLinePrefix, StringRef Base,
371372
std::vector<std::string> UserStylesheets)
372373
: ECtx(ECtx), ProjectName(ProjectName), PublicOnly(PublicOnly),
373374
OutDirectory(OutDirectory), UserStylesheets(UserStylesheets), Base(Base) {
@@ -381,6 +382,9 @@ ClangDocContext::ClangDocContext(tooling::ExecutionContext *ECtx,
381382
if (!RepositoryUrl.empty() && !RepositoryUrl.starts_with("http://") &&
382383
!RepositoryUrl.starts_with("https://"))
383384
this->RepositoryUrl->insert(0, "https://");
385+
386+
if (!RepositoryLinePrefix.empty())
387+
this->RepositoryLinePrefix = std::string(RepositoryLinePrefix);
384388
}
385389
}
386390

clang-tools-extra/clang-doc/Representation.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,8 @@ struct ClangDocContext {
507507
ClangDocContext() = default;
508508
ClangDocContext(tooling::ExecutionContext *ECtx, StringRef ProjectName,
509509
bool PublicOnly, StringRef OutDirectory, StringRef SourceRoot,
510-
StringRef RepositoryUrl, StringRef Base,
511-
std::vector<std::string> UserStylesheets);
510+
StringRef RepositoryUrl, StringRef RepositoryCodeLinePrefix,
511+
StringRef Base, std::vector<std::string> UserStylesheets);
512512
tooling::ExecutionContext *ECtx;
513513
std::string ProjectName; // Name of project clang-doc is documenting.
514514
bool PublicOnly; // Indicates if only public declarations are documented.
@@ -518,6 +518,8 @@ struct ClangDocContext {
518518
// the file is in this dir.
519519
// URL of repository that hosts code used for links to definition locations.
520520
std::optional<std::string> RepositoryUrl;
521+
// Prefix of line code for repository.
522+
std::optional<std::string> RepositoryLinePrefix;
521523
// Path of CSS stylesheets that will be copied to OutDirectory and used to
522524
// style all HTML files.
523525
std::vector<std::string> UserStylesheets;

clang-tools-extra/clang-doc/tool/ClangDocMain.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ URL of repository that hosts code.
105105
Used for links to definition locations.)"),
106106
llvm::cl::cat(ClangDocCategory));
107107

108+
static llvm::cl::opt<std::string> RepositoryCodeLinePrefix(
109+
"repository-line-prefix",
110+
llvm::cl::desc("Prefix of line code for repository."),
111+
llvm::cl::cat(ClangDocCategory));
112+
108113
enum OutputFormatTy {
109114
md,
110115
yaml,
@@ -273,6 +278,7 @@ Example usage for a project using a compile commands database:
273278
OutDirectory,
274279
SourceRoot,
275280
RepositoryUrl,
281+
RepositoryCodeLinePrefix,
276282
BaseDirectory,
277283
{UserStylesheets.begin(), UserStylesheets.end()}};
278284

clang-tools-extra/test/clang-doc/basic-project.test

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33

44
// RUN: clang-doc --format=html --output=%t/docs --executor=all-TUs %t/build/compile_commands.json
55
// RUN: FileCheck %s -input-file=%t/docs/index_json.js -check-prefix=JSON-INDEX
6+
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Shape.html -check-prefix=HTML-SHAPE
7+
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Calculator.html -check-prefix=HTML-CALC
8+
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Rectangle.html -check-prefix=HTML-RECTANGLE
9+
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Circle.html -check-prefix=HTML-CIRCLE
10+
11+
// RUN: clang-doc --format=html --output=%t/docs-with-prefix --executor=all-TUs %t/build/compile_commands.json --repository=https://repository.com --repository-line-prefix=L
12+
// RUN: FileCheck %s -input-file=%t/docs-with-prefix/GlobalNamespace/Shape.html -check-prefixes=HTML-SHAPE,SHAPE-LINE-PREFIX
13+
// RUN: FileCheck %s -input-file=%t/docs-with-prefix/GlobalNamespace/Calculator.html -check-prefixes=HTML-CALC,CALC-LINE-PREFIX
14+
// RUN: FileCheck %s -input-file=%t/docs-with-prefix/GlobalNamespace/Rectangle.html -check-prefixes=HTML-RECTANGLE,RECTANGLE-LINE-PREFIX
15+
// RUN: FileCheck %s -input-file=%t/docs-with-prefix/GlobalNamespace/Circle.html -check-prefixes=HTML-CIRCLE,CIRCLE-LINE-PREFIX
16+
617
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Shape.html -check-prefixes=HTML-SHAPE,SHAPE-NO-REPOSITORY
718
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Calculator.html -check-prefixes=HTML-CALC,CALC-NO-REPOSITORY
819
// RUN: FileCheck %s -input-file=%t/docs/GlobalNamespace/Rectangle.html -check-prefixes=HTML-RECTANGLE,RECTANGLE-NO-REPOSITORY
@@ -75,6 +86,7 @@
7586
// SHAPE-REPOSITORY: <p>
7687
// SHAPE-REPOSITORY-NEXT: Defined at line
7788
// SHAPE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Shape.h#8">8</a>
89+
// SHAPE-LINE-PREFIX: <a href="https://repository.com/./include/Shape.h#L8">8</a>
7890
// SHAPE-REPOSITORY-NEXT: of file
7991
// SHAPE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Shape.h">Shape.h</a>
8092
// SHAPE-REPOSITORY-NEXT: </p>
@@ -98,6 +110,7 @@
98110
// SHAPE-NO-REPOSITORY: Defined at line 13 of file .{{.}}include{{.}}Shape.h
99111
// SHAPE-REPOSITORY: Defined at line
100112
// SHAPE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Shape.h#13">13</a>
113+
// SHAPE-LINE-PREFIX: <a href="https://repository.com/./include/Shape.h#L13">13</a>
101114
// SHAPE-REPOSITORY-NEXT: of file
102115
// SHAPE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Shape.h">Shape.h</a>
103116

@@ -109,6 +122,7 @@
109122
// CALC-REPOSITORY: <p>
110123
// CALC-REPOSITORY-NEXT: Defined at line
111124
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./include/Calculator.h#8">8</a>
125+
// CALC-LINE-PREFIX: <a href="https://repository.com/./include/Calculator.h#L8">8</a>
112126
// CALC-REPOSITORY-NEXT: of file
113127
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./include/Calculator.h">Calculator.h</a>
114128
// CALC-REPOSITORY-NEXT: </p>
@@ -121,6 +135,7 @@
121135
// CALC-NO-REPOSITORY: Defined at line 3 of file .{{.}}src{{.}}Calculator.cpp
122136
// CALC-REPOSITORY: Defined at line
123137
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp#3">3</a>
138+
// CALC-LINE-PREFIX: <a href="https://repository.com/./src/Calculator.cpp#L3">3</a>
124139
// CALC-REPOSITORY-NEXT: of file
125140
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
126141

@@ -133,6 +148,7 @@
133148
// CALC-NO-REPOSITORY: Defined at line 7 of file .{{.}}src{{.}}Calculator.cpp
134149
// CALC-REPOSITORY: Defined at line
135150
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp#7">7</a>
151+
// CALC-LINE-PREFIX: <a href="https://repository.com/./src/Calculator.cpp#L7">7</a>
136152
// CALC-REPOSITORY-NEXT: of file
137153
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
138154

@@ -145,6 +161,7 @@
145161
// CALC-NO-REPOSITORY: Defined at line 11 of file .{{.}}src{{.}}Calculator.cpp
146162
// CALC-REPOSITORY: Defined at line
147163
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp#11">11</a>
164+
// CALC-LINE-PREFIX: <a href="https://repository.com/./src/Calculator.cpp#L11">11</a>
148165
// CALC-REPOSITORY-NEXT: of file
149166
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
150167

@@ -157,6 +174,7 @@
157174
// CALC-NO-REPOSITORY: Defined at line 15 of file .{{.}}src{{.}}Calculator.cpp
158175
// CALC-REPOSITORY: Defined at line
159176
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp#15">15</a>
177+
// CALC-LINE-PREFIX: <a href="https://repository.com/./src/Calculator.cpp#L15">15</a>
160178
// CALC-REPOSITORY-NEXT: of file
161179
// CALC-REPOSITORY-NEXT: <a href="https://repository.com/./src/Calculator.cpp">Calculator.cpp</a>
162180

@@ -172,6 +190,7 @@
172190
// RECTANGLE-REPOSITORY: <p>
173191
// RECTANGLE-REPOSITORY-NEXT: Defined at line
174192
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Rectangle.h#10">10</a>
193+
// RECTANGLE-LINE-PREFIX: <a href="https://repository.com/./include/Rectangle.h#L10">10</a>
175194
// RECTANGLE-REPOSITORY-NEXT: of file
176195
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Rectangle.h">Rectangle.h</a>
177196
// RECTANGLE-REPOSITORY-NEXT: </p>
@@ -192,6 +211,7 @@
192211
// RECTANGLE-NO-REPOSITORY: Defined at line 3 of file .{{.}}src{{.}}Rectangle.cpp
193212
// RECTANGLE-REPOSITORY: Defined at line
194213
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp#3">3</a>
214+
// RECTANGLE-LINE-PREFIX: <a href="https://repository.com/./src/Rectangle.cpp#L3">3</a>
195215
// RECTANGLE-REPOSITORY-NEXT: of file
196216
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp">Rectangle.cpp</a>
197217

@@ -202,6 +222,7 @@
202222
// RECTANGLE-NO-REPOSITORY: Defined at line 6 of file .{{.}}src{{.}}Rectangle.cpp
203223
// RECTANGLE-REPOSITORY: Defined at line
204224
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp#6">6</a>
225+
// RECTANGLE-LINE-PREFIX: <a href="https://repository.com/./src/Rectangle.cpp#L6">6</a>
205226
// RECTANGLE-REPOSITORY-NEXT: of file
206227
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp">Rectangle.cpp</a>
207228

@@ -214,6 +235,7 @@
214235
// RECTANGLE-NO-REPOSITORY: Defined at line 10 of file .{{.}}src{{.}}Rectangle.cpp
215236
// RECTANGLE-REPOSITORY: Defined at line
216237
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp#10">10</a>
238+
// RECTANGLE-LINE-PREFIX: <a href="https://repository.com/./src/Rectangle.cpp#L10">10</a>
217239
// RECTANGLE-REPOSITORY-NEXT: of file
218240
// RECTANGLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Rectangle.cpp">Rectangle.cpp</a>
219241
// HTML-RECTANGLE: <div>brief</div>
@@ -226,6 +248,7 @@
226248
// CIRCLE-REPOSITORY: <p>
227249
// CIRCLE-REPOSITORY-NEXT: Defined at line
228250
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Circle.h#10">10</a>
251+
// CIRCLE-LINE-PREFIX: <a href="https://repository.com/./include/Circle.h#L10">10</a>
229252
// CIRCLE-REPOSITORY-NEXT: of file
230253
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./include/Circle.h">Circle.h</a>
231254
// CIRCLE-REPOSITORY-NEXT: </p>
@@ -246,6 +269,7 @@
246269
// CIRCLE-NO-REPOSITORY: Defined at line 3 of file .{{.}}src{{.}}Circle.cpp
247270
// CIRCLE-REPOSITORY: Defined at line
248271
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp#3">3</a>
272+
// CIRCLE-LINE-PREFIX: <a href="https://repository.com/./src/Circle.cpp#L3">3</a>
249273
// CIRCLE-REPOSITORY-NEXT: of file
250274
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp">Circle.cpp</a>
251275

@@ -256,6 +280,7 @@
256280
// CIRCLE-NO-REPOSITORY: Defined at line 5 of file .{{.}}src{{.}}Circle.cpp
257281
// CIRCLE-REPOSITORY: Defined at line
258282
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp#5">5</a>
283+
// CIRCLE-LINE-PREFIX: <a href="https://repository.com/./src/Circle.cpp#L5">5</a>
259284
// CIRCLE-REPOSITORY-NEXT: of file
260285
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp">Circle.cpp</a>
261286

@@ -268,6 +293,7 @@
268293
// CIRCLE-NO-REPOSITORY: Defined at line 9 of file .{{.}}src{{.}}Circle.cpp
269294
// CIRCLE-REPOSITORY: Defined at line
270295
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp#9">9</a>
296+
// CIRCLE-LINE-PREFIX: <a href="https://repository.com/./src/Circle.cpp#L9">9</a>
271297
// CIRCLE-REPOSITORY-NEXT: of file
272298
// CIRCLE-REPOSITORY-NEXT: <a href="https://repository.com/./src/Circle.cpp">Circle.cpp</a>
273299

@@ -384,3 +410,4 @@
384410

385411
// MD-INDEX: # C/C++ Reference
386412
// MD-INDEX: * Namespace: [GlobalNamespace](GlobalNamespace)
413+

clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ std::unique_ptr<Generator> getHTMLGenerator() {
2828

2929
ClangDocContext
3030
getClangDocContext(std::vector<std::string> UserStylesheets = {},
31-
StringRef RepositoryUrl = "", StringRef Base = "") {
32-
ClangDocContext CDCtx{{}, "test-project", {}, {},
33-
{}, RepositoryUrl, Base, UserStylesheets};
31+
StringRef RepositoryUrl = "",
32+
StringRef RepositoryLinePrefix = "", StringRef Base = "") {
33+
ClangDocContext CDCtx{
34+
{}, "test-project", {}, {}, {}, RepositoryUrl, RepositoryLinePrefix,
35+
Base, UserStylesheets};
3436
CDCtx.UserStylesheets.insert(
3537
CDCtx.UserStylesheets.begin(),
3638
"../share/clang/clang-doc-default-stylesheet.css");

0 commit comments

Comments
 (0)