Skip to content

Commit aacb0eb

Browse files
committed
CXX: extract reference tags
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent b239c62 commit aacb0eb

File tree

19 files changed

+296
-10
lines changed

19 files changed

+296
-10
lines changed

Tmain/list-kinds-full.d/stdout-expected.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#LETTER NAME ENABLED REFONLY NROLES MASTER DESCRIPTION
22
D macroparam no no 0 C parameters inside macro definitions
33
L label no no 0 C goto labels
4+
Y unknown no yes 1 C unknown identifier
45
d macro yes no 2 C macro definitions
56
e enumerator yes no 0 C enumerators (values inside an enumeration)
67
f function yes no 0 C function definitions
@@ -21,6 +22,7 @@ D macroparam no no 0 C parameters inside macro definitions
2122
L label no no 0 C goto labels
2223
N name no no 0 NONE names imported via using scope::symbol
2324
U using no no 0 NONE using namespace statements
25+
Y unknown no yes 1 C unknown identifier
2426
Z tparam no no 0 NONE template parameters
2527
c class yes no 0 NONE classes
2628
d macro yes no 2 C macro definitions

Tmain/list-roles.d/stdout-expected.txt

+31
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ Automake d/directory program on directory for PROGRA
1818
Automake d/directory script on directory for SCRIPTS primary
1919
Basic f/function decl on declared
2020
Bats S/script loaded on script loaed with "load" command
21+
C Y/unknown ref off referenced anyhow
2122
C d/macro condition off used in part of #if/#ifdef/#elif conditions
2223
C d/macro undef on undefined
2324
C h/header local on local header
2425
C h/header system on system header
26+
C++ Y/unknown ref off referenced anyhow
2527
C++ d/macro condition off used in part of #if/#ifdef/#elif conditions
2628
C++ d/macro undef on undefined
2729
C++ h/header local on local header
@@ -30,6 +32,7 @@ CPreProcessor d/macro condition off used in part of #if/
3032
CPreProcessor d/macro undef on undefined
3133
CPreProcessor h/header local on local header
3234
CPreProcessor h/header system on system header
35+
CUDA Y/unknown ref off referenced anyhow
3336
CUDA d/macro condition off used in part of #if/#ifdef/#elif conditions
3437
CUDA d/macro undef on undefined
3538
CUDA h/header local on local header
@@ -136,10 +139,12 @@ Automake d/directory program on directory for PROGRA
136139
Automake d/directory script on directory for SCRIPTS primary
137140
Basic f/function decl on declared
138141
Bats S/script loaded on script loaed with "load" command
142+
C Y/unknown ref off referenced anyhow
139143
C d/macro condition off used in part of #if/#ifdef/#elif conditions
140144
C d/macro undef on undefined
141145
C h/header local on local header
142146
C h/header system on system header
147+
C++ Y/unknown ref off referenced anyhow
143148
C++ d/macro condition off used in part of #if/#ifdef/#elif conditions
144149
C++ d/macro undef on undefined
145150
C++ h/header local on local header
@@ -148,6 +153,7 @@ CPreProcessor d/macro condition off used in part of #if/
148153
CPreProcessor d/macro undef on undefined
149154
CPreProcessor h/header local on local header
150155
CPreProcessor h/header system on system header
156+
CUDA Y/unknown ref off referenced anyhow
151157
CUDA d/macro condition off used in part of #if/#ifdef/#elif conditions
152158
CUDA d/macro undef on undefined
153159
CUDA h/header local on local header
@@ -239,6 +245,7 @@ Zsh s/script loaded on loaded
239245
# C.*
240246
#
241247
#KIND(L/N) NAME ENABLED DESCRIPTION
248+
Y/unknown ref off referenced anyhow
242249
d/macro condition off used in part of #if/#ifdef/#elif conditions
243250
d/macro undef on undefined
244251
h/header local on local header
@@ -276,6 +283,7 @@ s/script loaded on loaded
276283
# C.* with disabling all roles of all languages
277284
#
278285
#KIND(L/N) NAME ENABLED DESCRIPTION
286+
Y/unknown ref off referenced anyhow
279287
d/macro condition off used in part of #if/#ifdef/#elif conditions
280288
d/macro undef off undefined
281289
h/header local off local header
@@ -285,6 +293,7 @@ h/header system off system header
285293
# C.* with disabling all roles of all kinds of all languages
286294
#
287295
#KIND(L/N) NAME ENABLED DESCRIPTION
296+
Y/unknown ref off referenced anyhow
288297
d/macro condition off used in part of #if/#ifdef/#elif conditions
289298
d/macro undef off undefined
290299
h/header local off local header
@@ -295,6 +304,7 @@ h/header system off system header
295304
# after disabling system role of header kind of C language
296305
#
297306
#KIND(L/N) NAME ENABLED DESCRIPTION
307+
Y/unknown ref on referenced anyhow
298308
d/macro condition on used in part of #if/#ifdef/#elif conditions
299309
d/macro undef on undefined
300310
h/header local on local header
@@ -305,6 +315,7 @@ h/header system on system header
305315
# after disabling system role of header kind of C language
306316
#
307317
#KIND(L/N) NAME ENABLED DESCRIPTION
318+
Y/unknown ref on referenced anyhow
308319
d/macro condition on used in part of #if/#ifdef/#elif conditions
309320
d/macro undef on undefined
310321
h/header local on local header
@@ -314,6 +325,7 @@ h/header system on system header
314325
# C.* with disabling all roles in C language
315326
#
316327
#KIND(L/N) NAME ENABLED DESCRIPTION
328+
Y/unknown ref off referenced anyhow
317329
d/macro condition off used in part of #if/#ifdef/#elif conditions
318330
d/macro undef off undefined
319331
h/header local off local header
@@ -330,6 +342,7 @@ s/script loaded on loaded
330342
# C.* with disabling all roles of all kinds in C language
331343
#
332344
#KIND(L/N) NAME ENABLED DESCRIPTION
345+
Y/unknown ref off referenced anyhow
333346
d/macro condition off used in part of #if/#ifdef/#elif conditions
334347
d/macro undef off undefined
335348
h/header local off local header
@@ -347,6 +360,7 @@ s/script loaded on loaded
347360
# after disabling all roles in all languages
348361
#
349362
#KIND(L/N) NAME ENABLED DESCRIPTION
363+
Y/unknown ref on referenced anyhow
350364
d/macro condition on used in part of #if/#ifdef/#elif conditions
351365
d/macro undef on undefined
352366
h/header local on local header
@@ -365,6 +379,7 @@ s/script loaded off loaded
365379
# after disabling all roles in all languages
366380
#
367381
#KIND(L/N) NAME ENABLED DESCRIPTION
382+
Y/unknown ref on referenced anyhow
368383
d/macro condition on used in part of #if/#ifdef/#elif conditions
369384
d/macro undef on undefined
370385
h/header local on local header
@@ -382,6 +397,7 @@ s/script loaded off loaded
382397
# C.* with disabling all roles of {header} kind in C language
383398
#
384399
#KIND(L/N) NAME ENABLED DESCRIPTION
400+
Y/unknown ref off referenced anyhow
385401
d/macro condition off used in part of #if/#ifdef/#elif conditions
386402
d/macro undef on undefined
387403
h/header local off local header
@@ -398,6 +414,7 @@ s/script loaded on loaded
398414
# C.* with disabling all roles of h kind in C language
399415
#
400416
#KIND(L/N) NAME ENABLED DESCRIPTION
417+
Y/unknown ref off referenced anyhow
401418
d/macro condition off used in part of #if/#ifdef/#elif conditions
402419
d/macro undef on undefined
403420
h/header local off local header
@@ -415,6 +432,7 @@ s/script loaded on loaded
415432
# after disabling all roles in all languages
416433
#
417434
#KIND(L/N) NAME ENABLED DESCRIPTION
435+
Y/unknown ref off referenced anyhow
418436
d/macro condition off used in part of #if/#ifdef/#elif conditions
419437
d/macro undef off undefined
420438
h/header local on local header
@@ -433,6 +451,7 @@ s/script loaded off loaded
433451
# after disabling all roles in all languages
434452
#
435453
#KIND(L/N) NAME ENABLED DESCRIPTION
454+
Y/unknown ref off referenced anyhow
436455
d/macro condition off used in part of #if/#ifdef/#elif conditions
437456
d/macro undef off undefined
438457
h/header local on local header
@@ -450,6 +469,7 @@ s/script loaded off loaded
450469
# C.* with disabling system role of h kind
451470
#
452471
#KIND(L/N) NAME ENABLED DESCRIPTION
472+
Y/unknown ref off referenced anyhow
453473
d/macro condition off used in part of #if/#ifdef/#elif conditions
454474
d/macro undef on undefined
455475
h/header local on local header
@@ -459,6 +479,7 @@ h/header system off system header
459479
# C.* with disabling system role of {header} kind
460480
#
461481
#KIND(L/N) NAME ENABLED DESCRIPTION
482+
Y/unknown ref off referenced anyhow
462483
d/macro condition off used in part of #if/#ifdef/#elif conditions
463484
d/macro undef on undefined
464485
h/header local on local header
@@ -468,6 +489,7 @@ h/header system off system header
468489
# C.* with enabling system role of h kind after disabling the role
469490
#
470491
#KIND(L/N) NAME ENABLED DESCRIPTION
492+
Y/unknown ref off referenced anyhow
471493
d/macro condition off used in part of #if/#ifdef/#elif conditions
472494
d/macro undef on undefined
473495
h/header local on local header
@@ -477,6 +499,7 @@ h/header system on system header
477499
# C.* with enabling system role of {header} kind after disabling the role
478500
#
479501
#KIND(L/N) NAME ENABLED DESCRIPTION
502+
Y/unknown ref off referenced anyhow
480503
d/macro condition off used in part of #if/#ifdef/#elif conditions
481504
d/macro undef on undefined
482505
h/header local on local header
@@ -486,6 +509,7 @@ h/header system on system header
486509
# C.* with disabling system and local roles of h kind
487510
#
488511
#KIND(L/N) NAME ENABLED DESCRIPTION
512+
Y/unknown ref off referenced anyhow
489513
d/macro condition off used in part of #if/#ifdef/#elif conditions
490514
d/macro undef on undefined
491515
h/header local off local header
@@ -495,6 +519,7 @@ h/header system off system header
495519
# C.* with disabling system and local roles of {header} kind
496520
#
497521
#KIND(L/N) NAME ENABLED DESCRIPTION
522+
Y/unknown ref off referenced anyhow
498523
d/macro condition off used in part of #if/#ifdef/#elif conditions
499524
d/macro undef on undefined
500525
h/header local off local header
@@ -505,6 +530,7 @@ h/header system off system header
505530
# after disabling all roles in all languages
506531
#
507532
#KIND(L/N) NAME ENABLED DESCRIPTION
533+
Y/unknown ref off referenced anyhow
508534
d/macro condition off used in part of #if/#ifdef/#elif conditions
509535
d/macro undef off undefined
510536
h/header local on local header
@@ -515,6 +541,7 @@ h/header system on system header
515541
# after disabling all roles in all languages
516542
#
517543
#KIND(L/N) NAME ENABLED DESCRIPTION
544+
Y/unknown ref off referenced anyhow
518545
d/macro condition off used in part of #if/#ifdef/#elif conditions
519546
d/macro undef off undefined
520547
h/header local on local header
@@ -524,6 +551,7 @@ h/header system on system header
524551
# C.* with disabling local role of h kind and undef role of d kind
525552
#
526553
#KIND(L/N) NAME ENABLED DESCRIPTION
554+
Y/unknown ref off referenced anyhow
527555
d/macro condition off used in part of #if/#ifdef/#elif conditions
528556
d/macro undef off undefined
529557
h/header local off local header
@@ -533,6 +561,7 @@ h/header system on system header
533561
# C.* with enabling all roles of header kinds after disabling all roles of the kind
534562
#
535563
#KIND(L/N) NAME ENABLED DESCRIPTION
564+
Y/unknown ref off referenced anyhow
536565
d/macro condition off used in part of #if/#ifdef/#elif conditions
537566
d/macro undef on undefined
538567
h/header local on local header
@@ -542,6 +571,7 @@ h/header system on system header
542571
# C.* with enabling all roles of header kinds after disabling all roles of the kinds of C language
543572
#
544573
#KIND(L/N) NAME ENABLED DESCRIPTION
574+
Y/unknown ref off referenced anyhow
545575
d/macro condition off used in part of #if/#ifdef/#elif conditions
546576
d/macro undef off undefined
547577
h/header local on local header
@@ -551,6 +581,7 @@ h/header system on system header
551581
# C.* with enabling all roles of header kinds after disabling all roles of the kinds of C language (short notation)
552582
#
553583
#KIND(L/N) NAME ENABLED DESCRIPTION
584+
Y/unknown ref off referenced anyhow
554585
d/macro condition off used in part of #if/#ifdef/#elif conditions
555586
d/macro undef off undefined
556587
h/header local on local header

Tmain/nested-subparsers.d/stdout-expected.txt

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ x external and forward variable declarations [off]
1717
z function parameters inside function or prototype definitions [off]
1818
L goto labels [off]
1919
D parameters inside macro definitions [off]
20+
Y unknown identifier [off]
2021
#
2122
# list kinds Event
2223
#
@@ -36,6 +37,7 @@ n name
3637
#LETTER NAME ENABLED REFONLY NROLES MASTER DESCRIPTION
3738
D macroparam no no 0 C parameters inside macro definitions
3839
L label no no 0 C goto labels
40+
Y unknown no yes 1 C unknown identifier
3941
d macro yes no 2 C macro definitions
4042
e enumerator yes no 0 C enumerators (values inside an enumeration)
4143
f function yes no 0 C function definitions
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
--sort=no
2+
--extras=+r
3+
--fields=+r
4+
--kinds-C=*
5+
--roles-C.{unknown}=*
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
x input.c /^struct x {$/;" s file: roles:def
2+
y input.c /^ int y;$/;" m struct:x typeref:typename:int file: roles:def
3+
X input.c /^enum X {$/;" g file: roles:def
4+
A input.c /^ A, B$/;" e enum:X file: roles:def
5+
B input.c /^ A, B$/;" e enum:X file: roles:def
6+
i input.c /^extern int i;$/;" x typeref:typename:int roles:def
7+
f input.c /^int f(int j)$/;" f typeref:typename:int roles:def
8+
j input.c /^int f(int j)$/;" z function:f typeref:typename:int file: roles:def
9+
j input.c /^ if (j == 0)$/;" Y roles:ref
10+
i input.c /^ return i + B + j + f(0);$/;" Y roles:ref
11+
B input.c /^ return i + B + j + f(0);$/;" Y roles:ref
12+
j input.c /^ return i + B + j + f(0);$/;" Y roles:ref
13+
f input.c /^ return i + B + j + f(0);$/;" Y roles:ref

Units/parser-c.r/c-reftags.d/input.c

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
struct x {
2+
int y;
3+
};
4+
5+
enum X {
6+
A, B
7+
};
8+
9+
extern int i;
10+
int f(int j)
11+
{
12+
if (j == 0)
13+
return 0;
14+
return i + B + j + f(0);
15+
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__anon21d591360111 input.h /^{$/;" n
2-
foo input.h /^ int foo;$/;" v namespace:__anon21d591360111 typeref:typename:int
1+
__anon21d591360112 input.h /^{$/;" n
2+
foo input.h /^ int foo;$/;" v namespace:__anon21d591360112 typeref:typename:int

Units/parser-cxx.r/namespace.cpp.d/expected.tags

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
__anon396601200111 input.cpp /^namespace {$/;" n file: end:8
2-
anon_f input.cpp /^ void anon_f() { };$/;" f namespace:__anon396601200111 typeref:typename:void end:3
3-
__anon396601200211 input.cpp /^ namespace {$/;" n namespace:__anon396601200111 file: end:7
4-
anon_anon_f input.cpp /^ void anon_anon_f() { };$/;" f namespace:__anon396601200111::__anon396601200211 typeref:typename:void end:6
1+
__anon396601200112 input.cpp /^namespace {$/;" n file: end:8
2+
anon_f input.cpp /^ void anon_f() { };$/;" f namespace:__anon396601200112 typeref:typename:void end:3
3+
__anon396601200212 input.cpp /^ namespace {$/;" n namespace:__anon396601200112 file: end:7
4+
anon_anon_f input.cpp /^ void anon_anon_f() { };$/;" f namespace:__anon396601200112::__anon396601200212 typeref:typename:void end:6
55
a1 input.cpp /^namespace a1 {$/;" n file: end:24
66
a1_f input.cpp /^ void a1_f() { }$/;" f namespace:a1 typeref:typename:void end:11
77
a2 input.cpp /^ namespace a2 {$/;" n namespace:a1 file: end:19
88
a1_a2_f input.cpp /^ void a1_a2_f() { }$/;" f namespace:a1::a2 typeref:typename:void end:14
99
a3 input.cpp /^ namespace a3 {$/;" n namespace:a1::a2 file: end:18
1010
a1_a2_a3_f input.cpp /^ void a1_a2_a3_f() { };$/;" f namespace:a1::a2::a3 typeref:typename:void end:17
11-
__anon396601200311 input.cpp /^ namespace {$/;" n namespace:a1 file: end:23
12-
a1_anon_f input.cpp /^ void a1_anon_f() { };$/;" f namespace:a1::__anon396601200311 typeref:typename:void end:22
11+
__anon396601200312 input.cpp /^ namespace {$/;" n namespace:a1 file: end:23
12+
a1_anon_f input.cpp /^ void a1_anon_f() { };$/;" f namespace:a1::__anon396601200312 typeref:typename:void end:22
1313
b1 input.cpp /^namespace b1::b2 {$/;" n file: end:32
1414
b2 input.cpp /^namespace b1::b2 {$/;" n namespace:b1 file: end:32
1515
b1_b2_f input.cpp /^ void b1_b2_f() { };$/;" f namespace:b1::b2 typeref:typename:void end:27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
--sort=no
2+
--kinds-C++=+p
3+
--fields=+lK
4+
--extras=+r
5+
--kinds-C++=+{unknown}
6+
--roles-C++.{unknown}=+{ref}

0 commit comments

Comments
 (0)