Skip to content

Commit b856952

Browse files
authored
[clang-doc][NFC] Make test resilient to line changes (#119811)
This just reorganizes the test code, so its easy to use @line directives in the test, and avoid needing to update all the line numbers when making unrelated changes.
1 parent bc627a4 commit b856952

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

clang-tools-extra/test/clang-doc/templates.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,17 @@
66
// RUN: cat %t/docs/index.yaml | FileCheck %s --check-prefix=YAML
77
// RUN: rm -rf %t
88

9-
template<typename T, int U = 1>
10-
void function(T x) {}
11-
12-
template<>
13-
void function<bool, 0>(bool x) {}
9+
// YAML: ---
10+
// YAML-NEXT: USR: '{{([0-9A-F]{40})}}'
1411

1512
template<class... T>
1613
void ParamPackFunction(T... args);
1714

18-
// YAML: ---
19-
// YAML-NEXT: USR: '{{([0-9A-F]{40})}}'
2015
// YAML-NEXT: ChildFunctions:
2116
// YAML-NEXT: - USR: '{{([0-9A-F]{40})}}'
2217
// YAML-NEXT: Name: 'ParamPackFunction'
2318
// YAML-NEXT: Location:
24-
// YAML-NEXT: - LineNumber: 16
19+
// YAML-NEXT: - LineNumber: [[# @LINE - 6]]
2520
// YAML-NEXT: Filename: '{{.*}}'
2621
// YAML-NEXT: Params:
2722
// YAML-NEXT: - Type:
@@ -35,10 +30,14 @@ void ParamPackFunction(T... args);
3530
// YAML-NEXT: Template:
3631
// YAML-NEXT: Params:
3732
// YAML-NEXT: - Contents: 'class... T'
33+
34+
template<typename T, int U = 1>
35+
void function(T x) {}
36+
3837
// YAML-NEXT: - USR: '{{([0-9A-F]{40})}}'
3938
// YAML-NEXT: Name: 'function'
4039
// YAML-NEXT: DefLocation:
41-
// YAML-NEXT: LineNumber: 10
40+
// YAML-NEXT: LineNumber: [[# @LINE - 5]]
4241
// YAML-NEXT: Filename: '{{.*}}'
4342
// YAML-NEXT: Params:
4443
// YAML-NEXT: - Type:
@@ -53,10 +52,14 @@ void ParamPackFunction(T... args);
5352
// YAML-NEXT: Params:
5453
// YAML-NEXT: - Contents: 'typename T'
5554
// YAML-NEXT: - Contents: 'int U = 1'
55+
56+
template<>
57+
void function<bool, 0>(bool x) {}
58+
5659
// YAML-NEXT: - USR: '{{([0-9A-F]{40})}}'
5760
// YAML-NEXT: Name: 'function'
5861
// YAML-NEXT: DefLocation:
59-
// YAML-NEXT: LineNumber: 12
62+
// YAML-NEXT: LineNumber: [[# @LINE - 6]]
6063
// YAML-NEXT: Filename: '{{.*}}'
6164
// YAML-NEXT: Params:
6265
// YAML-NEXT: - Type:
@@ -74,3 +77,4 @@ void ParamPackFunction(T... args);
7477
// YAML-NEXT: - Contents: 'bool'
7578
// YAML-NEXT: - Contents: '0'
7679
// YAML-NEXT: ...
80+

0 commit comments

Comments
 (0)