Skip to content

Commit b3d9350

Browse files
authored
Merge pull request #815 from geoffw0/keyset
CPP: dbscheme annotations
2 parents dedefe0 + 4e1e313 commit b3d9350

File tree

1 file changed

+28
-17
lines changed

1 file changed

+28
-17
lines changed

cpp/ql/src/semmlecode.cpp.dbscheme

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ compilations(
3939
* 5 | f2.c
4040
* 6 | f3.c
4141
*/
42+
#keyset[id, num]
4243
compilation_args(
4344
int id : @compilation ref,
4445
int num : int ref,
@@ -62,6 +63,7 @@ compilation_args(
6263
* Note that even if those files `#include` headers, those headers
6364
* do not appear as rows.
6465
*/
66+
#keyset[id, num]
6567
compilation_compiling_files(
6668
int id : @compilation ref,
6769
int num : int ref,
@@ -80,6 +82,7 @@ compilation_compiling_files(
8082
* 3 | CPU seconds used by the extractor backend
8183
* 4 | Elapsed seconds during the extractor backend
8284
*/
85+
#keyset[id, num, kind]
8386
compilation_time(
8487
int id : @compilation ref,
8588
int num : int ref,
@@ -95,13 +98,14 @@ compilation_time(
9598

9699
/**
97100
* An error or warning generated by the extractor.
98-
* The diagnosstic message `diagnostic` was generated during compiler
101+
* The diagnostic message `diagnostic` was generated during compiler
99102
* invocation `compilation`, and is the `file_number_diagnostic_number`th
100103
* message generated while extracting the `file_number`th file of that
101104
* invocation.
102105
*/
106+
#keyset[compilation, file_number, file_number_diagnostic_number]
103107
diagnostic_for(
104-
int diagnostic : @diagnostic ref,
108+
unique int diagnostic : @diagnostic ref,
105109
int compilation : @compilation ref,
106110
int file_number : int ref,
107111
int file_number_diagnostic_number : int ref
@@ -110,7 +114,7 @@ diagnostic_for(
110114
/**
111115
* If extraction was successful, then `cpu_seconds` and
112116
* `elapsed_seconds` are the CPU time and elapsed time (respectively)
113-
* that extractino took for compiler invocation `id`.
117+
* that extraction took for compiler invocation `id`.
114118
*/
115119
compilation_finished(
116120
unique int id : @compilation ref,
@@ -167,6 +171,7 @@ similarCode(
167171
/**
168172
* Data used by the 'duplicate code' and 'similar code' detection.
169173
*/
174+
#keyset[id, offset]
170175
tokens(
171176
int id : @duplication_or_similarity ref,
172177
int offset : int ref,
@@ -197,7 +202,7 @@ header_to_external_package(
197202
*/
198203

199204
svnentries(
200-
int id : @svnentry,
205+
unique int id : @svnentry,
201206
string revision : string ref,
202207
string author : string ref,
203208
date revisionDate : date ref,
@@ -211,7 +216,7 @@ svnaffectedfiles(
211216
)
212217

213218
svnentrymsg(
214-
int id : @svnentry ref,
219+
unique int id : @svnentry ref,
215220
string message : string ref
216221
)
217222

@@ -233,7 +238,7 @@ svnchurn(
233238
* The location spans column `startcolumn` of line `startline` to
234239
* column `endcolumn` of line `endline` in file `file`.
235240
* For more information, see
236-
* [LGTM locations](https://lgtm.com/docs/ql/locations).
241+
* [Locations](https://help.semmle.com/QL/learn-ql/ql/locations.html).
237242
*/
238243
locations_default(
239244
/** The location of an element that is not an expression or a statement. */
@@ -250,7 +255,7 @@ locations_default(
250255
* The location spans column `startcolumn` of line `startline` to
251256
* column `endcolumn` of line `endline` in file `file`.
252257
* For more information, see
253-
* [LGTM locations](https://lgtm.com/docs/ql/locations).
258+
* [Locations](https://help.semmle.com/QL/learn-ql/ql/locations.html).
254259
*/
255260
locations_stmt(
256261
/** The location of a statement. */
@@ -267,7 +272,7 @@ locations_stmt(
267272
* The location spans column `startcolumn` of line `startline` to
268273
* column `endcolumn` of line `endline` in file `file`.
269274
* For more information, see
270-
* [LGTM locations](https://lgtm.com/docs/ql/locations).
275+
* [Locations](https://help.semmle.com/QL/learn-ql/ql/locations.html).
271276
*/
272277
locations_expr(
273278
/** The location of an expression. */
@@ -398,7 +403,7 @@ functions(
398403
int kind: int ref
399404
);
400405

401-
function_entry_point(int id: @function ref, int entry_point: @stmt ref);
406+
function_entry_point(int id: @function ref, unique int entry_point: @stmt ref);
402407

403408
function_return_type(int id: @function ref, int return_type: @type ref);
404409

@@ -424,6 +429,7 @@ fun_decl_specifiers(
424429
int id: @fun_decl ref,
425430
string name: string ref
426431
)
432+
#keyset[fun_decl, index]
427433
fun_decl_throws(
428434
int fun_decl: @fun_decl ref,
429435
int index: int ref,
@@ -497,6 +503,8 @@ static_asserts(
497503
);
498504

499505
// each function has an ordered list of parameters
506+
#keyset[id, type_id]
507+
#keyset[function, index, type_id]
500508
params(
501509
int id: @parameter,
502510
int function: @functionorblock ref,
@@ -1488,8 +1496,9 @@ new_array_allocated_type(
14881496
* The field being initialized by an initializer expression within an aggregate
14891497
* initializer for a class/struct/union.
14901498
*/
1499+
#keyset[aggregate, field]
14911500
aggregate_field_init(
1492-
unique int aggregate: @aggregateliteral ref,
1501+
int aggregate: @aggregateliteral ref,
14931502
int initializer: @expr ref,
14941503
int field: @membervariable ref
14951504
);
@@ -1498,8 +1507,9 @@ aggregate_field_init(
14981507
* The index of the element being initialized by an initializer expression
14991508
* within an aggregate initializer for an array.
15001509
*/
1510+
#keyset[aggregate, element_index]
15011511
aggregate_array_init(
1502-
unique int aggregate: @aggregateliteral ref,
1512+
int aggregate: @aggregateliteral ref,
15031513
int initializer: @expr ref,
15041514
int element_index: int ref
15051515
);
@@ -1635,34 +1645,35 @@ do_body(
16351645
int body_id: @stmt ref
16361646
);
16371647

1648+
#keyset[switch_stmt, index]
16381649
switch_case(
16391650
int switch_stmt: @stmt_switch ref,
16401651
int index: int ref,
16411652
int case_id: @stmt_switch_case ref
16421653
);
16431654

16441655
switch_body(
1645-
int switch_stmt: @stmt_switch ref,
1656+
unique int switch_stmt: @stmt_switch ref,
16461657
int body_id: @stmt ref
16471658
);
16481659

16491660
for_initialization(
1650-
int for_stmt: @stmt_for ref,
1661+
unique int for_stmt: @stmt_for ref,
16511662
int init_id: @stmt ref
16521663
);
16531664

16541665
for_condition(
1655-
int for_stmt: @stmt_for ref,
1666+
unique int for_stmt: @stmt_for ref,
16561667
int condition_id: @expr ref
16571668
);
16581669

16591670
for_update(
1660-
int for_stmt: @stmt_for ref,
1671+
unique int for_stmt: @stmt_for ref,
16611672
int update_id: @expr ref
16621673
);
16631674

16641675
for_body(
1665-
int for_stmt: @stmt_for ref,
1676+
unique int for_stmt: @stmt_for ref,
16661677
int body_id: @stmt ref
16671678
);
16681679

@@ -1706,7 +1717,7 @@ stmt_decl_entry_bind(
17061717
@functionorblock = @function | @stmt_block;
17071718

17081719
blockscope(
1709-
int block: @stmt_block ref,
1720+
unique int block: @stmt_block ref,
17101721
int enclosing: @functionorblock ref
17111722
);
17121723

0 commit comments

Comments
 (0)