C++: synchronize dbscheme

This commit is contained in:
Jeroen Ketema
2025-06-30 14:14:14 +02:00
parent 7c38c48fd7
commit 617edf0b70
3 changed files with 133 additions and 154 deletions

View File

@@ -1,11 +1,13 @@
{ {
"files": [ "files": [
"cpp/ql/lib/semmlecode.cpp.dbscheme",
"javascript/ql/lib/semmlecode.javascript.dbscheme", "javascript/ql/lib/semmlecode.javascript.dbscheme",
"python/ql/lib/semmlecode.python.dbscheme", "python/ql/lib/semmlecode.python.dbscheme",
"ruby/ql/lib/ruby.dbscheme", "ruby/ql/lib/ruby.dbscheme",
"ql/ql/src/ql.dbscheme" "ql/ql/src/ql.dbscheme"
], ],
"fragments": [ "fragments": [
"/*- Compilations -*/",
"/*- External data -*/", "/*- External data -*/",
"/*- Files and folders -*/", "/*- Files and folders -*/",
"/*- Diagnostic messages -*/", "/*- Diagnostic messages -*/",
@@ -21,6 +23,7 @@
"/*- DEPRECATED: Snapshot date -*/", "/*- DEPRECATED: Snapshot date -*/",
"/*- DEPRECATED: Duplicate code -*/", "/*- DEPRECATED: Duplicate code -*/",
"/*- DEPRECATED: Version control data -*/", "/*- DEPRECATED: Version control data -*/",
"/*- C++ dbscheme -*/",
"/*- JavaScript-specific part -*/", "/*- JavaScript-specific part -*/",
"/*- Ruby dbscheme -*/", "/*- Ruby dbscheme -*/",
"/*- Erb dbscheme -*/", "/*- Erb dbscheme -*/",

View File

@@ -8,7 +8,7 @@ import semmle.code.cpp.File
/** /**
* A location of a C/C++ artifact. * A location of a C/C++ artifact.
*/ */
class Location extends @location { class Location extends @location_default {
/** Gets the container corresponding to this location. */ /** Gets the container corresponding to this location. */
pragma[nomagic] pragma[nomagic]
Container getContainer() { this.fullLocationInfo(result, _, _, _, _) } Container getContainer() { this.fullLocationInfo(result, _, _, _, _) }

View File

@@ -1,3 +1,4 @@
/*- Compilations -*/
/** /**
* An invocation of the compiler. Note that more than one file may be * An invocation of the compiler. Note that more than one file may be
@@ -138,6 +139,7 @@ compilation_finished(
float elapsed_seconds : float ref float elapsed_seconds : float ref
); );
/*- External data -*/
/** /**
* External data, loaded from CSV files during snapshot creation. See * External data, loaded from CSV files during snapshot creation. See
@@ -145,17 +147,76 @@ compilation_finished(
* for more information. * for more information.
*/ */
externalData( externalData(
int id : @externalDataElement, int id : @externalDataElement,
string path : string ref, string path : string ref,
int column: int ref, int column: int ref,
string value : string ref string value : string ref
); );
/*- Source location prefix -*/
/** /**
* The source location of the snapshot. * The source location of the snapshot.
*/ */
sourceLocationPrefix(string prefix : string ref); sourceLocationPrefix(string prefix : string ref);
/*- Files and folders -*/
/**
* The location of an element.
* The location spans column `startcolumn` of line `startline` to
* column `endcolumn` of line `endline` in file `file`.
* For more information, see
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
*/
locations_default(
unique int id: @location_default,
int file: @file ref,
int beginLine: int ref,
int beginColumn: int ref,
int endLine: int ref,
int endColumn: int ref
);
files(
unique int id: @file,
string name: string ref
);
folders(
unique int id: @folder,
string name: string ref
);
@container = @file | @folder
containerparent(
int parent: @container ref,
unique int child: @container ref
);
/*- Lines of code -*/
numlines(
int element_id: @sourceline ref,
int num_lines: int ref,
int num_code: int ref,
int num_comment: int ref
);
/*- Diagnostic messages -*/
diagnostics(
unique int id: @diagnostic,
int severity: int ref,
string error_tag: string ref,
string error_message: string ref,
string full_error_message: string ref,
int location: @location_default ref
);
/*- C++ dbscheme -*/
/** /**
* Information about packages that provide code used during compilation. * Information about packages that provide code used during compilation.
* The `id` is just a unique identifier. * The `id` is just a unique identifier.
@@ -179,36 +240,6 @@ header_to_external_package(
int package : @external_package ref int package : @external_package ref
); );
/*
* Version history
*/
svnentries(
unique int id : @svnentry,
string revision : string ref,
string author : string ref,
date revisionDate : date ref,
int changeSize : int ref
)
svnaffectedfiles(
int id : @svnentry ref,
int file : @file ref,
string action : string ref
)
svnentrymsg(
unique int id : @svnentry ref,
string message : string ref
)
svnchurn(
int commit : @svnentry ref,
int file : @file ref,
int addedLines : int ref,
int deletedLines : int ref
)
/* /*
* C++ dbscheme * C++ dbscheme
*/ */
@@ -218,61 +249,9 @@ extractor_version(
string frontend_version: string ref string frontend_version: string ref
) )
@location = @location_default ;
/**
* The location of an element.
* The location spans column `startcolumn` of line `startline` to
* column `endcolumn` of line `endline` in file `file`.
* For more information, see
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
*/
locations_default(
/** The location of an element that is not an expression or a statement. */
unique int id: @location_default,
int container: @container ref,
int startLine: int ref,
int startColumn: int ref,
int endLine: int ref,
int endColumn: int ref
);
/** An element for which line-count information is available. */ /** An element for which line-count information is available. */
@sourceline = @file | @function | @variable | @enumconstant | @xmllocatable; @sourceline = @file | @function | @variable | @enumconstant | @xmllocatable;
numlines(
int element_id: @sourceline ref,
int num_lines: int ref,
int num_code: int ref,
int num_comment: int ref
);
diagnostics(
unique int id: @diagnostic,
int severity: int ref,
string error_tag: string ref,
string error_message: string ref,
string full_error_message: string ref,
int location: @location ref
);
files(
unique int id: @file,
string name: string ref
);
folders(
unique int id: @folder,
string name: string ref
);
@container = @folder | @file
containerparent(
int parent: @container ref,
unique int child: @container ref
);
fileannotations( fileannotations(
int id: @file ref, int id: @file ref,
int kind: int ref, int kind: int ref,
@@ -298,7 +277,7 @@ case @macroinvocation.kind of
macroinvocations( macroinvocations(
unique int id: @macroinvocation, unique int id: @macroinvocation,
int macro_id: @ppd_define ref, int macro_id: @ppd_define ref,
int location: @location ref, int location: @location_default ref,
int kind: int ref int kind: int ref
); );
@@ -313,7 +292,7 @@ macroparent(
// to which a macro invocation is bound // to which a macro invocation is bound
macrolocationbind( macrolocationbind(
int id: @macroinvocation ref, int id: @macroinvocation ref,
int location: @location ref int location: @location_default ref
); );
#keyset[invocation, argument_index] #keyset[invocation, argument_index]
@@ -419,7 +398,7 @@ fun_decls(
int function: @function ref, int function: @function ref,
int type_id: @type ref, int type_id: @type ref,
string name: string ref, string name: string ref,
int location: @location ref int location: @location_default ref
); );
fun_def(unique int id: @fun_decl ref); fun_def(unique int id: @fun_decl ref);
fun_specialized(unique int id: @fun_decl ref); fun_specialized(unique int id: @fun_decl ref);
@@ -471,7 +450,7 @@ var_decls(
int variable: @variable ref, int variable: @variable ref,
int type_id: @type ref, int type_id: @type ref,
string name: string ref, string name: string ref,
int location: @location ref int location: @location_default ref
); );
var_def(unique int id: @var_decl ref); var_def(unique int id: @var_decl ref);
var_specialized(int id: @var_decl ref); var_specialized(int id: @var_decl ref);
@@ -488,7 +467,7 @@ var_requires(
type_decls( type_decls(
unique int id: @type_decl, unique int id: @type_decl,
int type_id: @type ref, int type_id: @type ref,
int location: @location ref int location: @location_default ref
); );
type_def(unique int id: @type_decl ref); type_def(unique int id: @type_decl ref);
type_decl_top( type_decl_top(
@@ -502,8 +481,8 @@ type_requires(
namespace_decls( namespace_decls(
unique int id: @namespace_decl, unique int id: @namespace_decl,
int namespace_id: @namespace ref, int namespace_id: @namespace ref,
int location: @location ref, int location: @location_default ref,
int bodylocation: @location ref int bodylocation: @location_default ref
); );
case @using.kind of case @using.kind of
@@ -515,7 +494,7 @@ case @using.kind of
usings( usings(
unique int id: @using, unique int id: @using,
int element_id: @element ref, int element_id: @element ref,
int location: @location ref, int location: @location_default ref,
int kind: int ref int kind: int ref
); );
@@ -529,7 +508,7 @@ static_asserts(
unique int id: @static_assert, unique int id: @static_assert,
int condition : @expr ref, int condition : @expr ref,
string message : string ref, string message : string ref,
int location: @location ref, int location: @location_default ref,
int enclosing : @element ref int enclosing : @element ref
); );
@@ -585,7 +564,7 @@ enumconstants(
int index: int ref, int index: int ref,
int type_id: @type ref, int type_id: @type ref,
string name: string ref, string name: string ref,
int location: @location ref int location: @location_default ref
); );
@variable = @localscopevariable | @globalvariable | @membervariable; @variable = @localscopevariable | @globalvariable | @membervariable;
@@ -889,7 +868,7 @@ is_proxy_class_for(
type_mentions( type_mentions(
unique int id: @type_mention, unique int id: @type_mention,
int type_id: @type ref, int type_id: @type ref,
int location: @location ref, int location: @location_default ref,
// a_symbol_reference_kind from the frontend. // a_symbol_reference_kind from the frontend.
int kind: int ref int kind: int ref
); );
@@ -946,7 +925,7 @@ template_template_argument_value(
concept_templates( concept_templates(
unique int concept_id: @concept_template, unique int concept_id: @concept_template,
string name: string ref, string name: string ref,
int location: @location ref int location: @location_default ref
); );
concept_instantiation( concept_instantiation(
unique int to: @concept_id ref, unique int to: @concept_id ref,
@@ -1050,7 +1029,7 @@ attributes(
int kind: int ref, int kind: int ref,
string name: string ref, string name: string ref,
string name_space: string ref, string name_space: string ref,
int location: @location ref int location: @location_default ref
); );
case @attribute.kind of case @attribute.kind of
@@ -1067,7 +1046,7 @@ attribute_args(
int kind: int ref, int kind: int ref,
int attribute: @attribute ref, int attribute: @attribute ref,
int index: int ref, int index: int ref,
int location: @location ref int location: @location_default ref
); );
case @attribute_arg.kind of case @attribute_arg.kind of
@@ -1156,7 +1135,7 @@ derivations(
int sub: @type ref, int sub: @type ref,
int index: int ref, int index: int ref,
int super: @type ref, int super: @type ref,
int location: @location ref int location: @location_default ref
); );
derspecifiers( derspecifiers(
@@ -1190,7 +1169,7 @@ frienddecls(
unique int id: @frienddecl, unique int id: @frienddecl,
int type_id: @type ref, int type_id: @type ref,
int decl_id: @declaration ref, int decl_id: @declaration ref,
int location: @location ref int location: @location_default ref
); );
@declaredtype = @usertype ; @declaredtype = @usertype ;
@@ -1247,7 +1226,7 @@ frienddecls(
comments( comments(
unique int id: @comment, unique int id: @comment,
string contents: string ref, string contents: string ref,
int location: @location ref int location: @location_default ref
); );
commentbinding( commentbinding(
@@ -1369,7 +1348,7 @@ namequalifiers(
unique int id: @namequalifier, unique int id: @namequalifier,
unique int qualifiableelement: @namequalifiableelement ref, unique int qualifiableelement: @namequalifiableelement ref,
int qualifyingelement: @namequalifyingelement ref, int qualifyingelement: @namequalifyingelement ref,
int location: @location ref int location: @location_default ref
); );
varbind( varbind(
@@ -1638,7 +1617,7 @@ initialisers(
unique int init: @initialiser, unique int init: @initialiser,
int var: @accessible ref, int var: @accessible ref,
unique int expr: @expr ref, unique int expr: @expr ref,
int location: @location ref int location: @location_default ref
); );
braced_initialisers( braced_initialisers(
@@ -1657,7 +1636,7 @@ expr_ancestor(
exprs( exprs(
unique int id: @expr, unique int id: @expr,
int kind: int ref, int kind: int ref,
int location: @location ref int location: @location_default ref
); );
expr_reuse( expr_reuse(
@@ -2131,7 +2110,7 @@ lambda_capture(
int field: @membervariable ref, int field: @membervariable ref,
boolean captured_by_reference: boolean ref, boolean captured_by_reference: boolean ref,
boolean is_implicit: boolean ref, boolean is_implicit: boolean ref,
int location: @location ref int location: @location_default ref
); );
@funbindexpr = @routineexpr @funbindexpr = @routineexpr
@@ -2159,7 +2138,7 @@ fold(
stmts( stmts(
unique int id: @stmt, unique int id: @stmt,
int kind: int ref, int kind: int ref,
int location: @location ref int location: @location_default ref
); );
case @stmt.kind of case @stmt.kind of
@@ -2344,7 +2323,7 @@ jumpinfo(
preprocdirects( preprocdirects(
unique int id: @preprocdirect, unique int id: @preprocdirect,
int kind: int ref, int kind: int ref,
int location: @location ref int location: @location_default ref
); );
case @preprocdirect.kind of case @preprocdirect.kind of
0 = @ppd_if 0 = @ppd_if
@@ -2400,76 +2379,73 @@ link_parent(
int link_target : @link_target ref int link_target : @link_target ref
); );
/* XML Files */ /*- XML Files -*/
xmlEncoding(unique int id: @file ref, string encoding: string ref); xmlEncoding(
unique int id: @file ref,
string encoding: string ref
);
xmlDTDs( xmlDTDs(
unique int id: @xmldtd, unique int id: @xmldtd,
string root: string ref, string root: string ref,
string publicId: string ref, string publicId: string ref,
string systemId: string ref, string systemId: string ref,
int fileid: @file ref int fileid: @file ref
); );
xmlElements( xmlElements(
unique int id: @xmlelement, unique int id: @xmlelement,
string name: string ref, string name: string ref,
int parentid: @xmlparent ref, int parentid: @xmlparent ref,
int idx: int ref, int idx: int ref,
int fileid: @file ref int fileid: @file ref
); );
xmlAttrs( xmlAttrs(
unique int id: @xmlattribute, unique int id: @xmlattribute,
int elementid: @xmlelement ref, int elementid: @xmlelement ref,
string name: string ref, string name: string ref,
string value: string ref, string value: string ref,
int idx: int ref, int idx: int ref,
int fileid: @file ref int fileid: @file ref
); );
xmlNs( xmlNs(
int id: @xmlnamespace, int id: @xmlnamespace,
string prefixName: string ref, string prefixName: string ref,
string URI: string ref, string URI: string ref,
int fileid: @file ref int fileid: @file ref
); );
xmlHasNs( xmlHasNs(
int elementId: @xmlnamespaceable ref, int elementId: @xmlnamespaceable ref,
int nsId: @xmlnamespace ref, int nsId: @xmlnamespace ref,
int fileid: @file ref int fileid: @file ref
); );
xmlComments( xmlComments(
unique int id: @xmlcomment, unique int id: @xmlcomment,
string text: string ref, string text: string ref,
int parentid: @xmlparent ref, int parentid: @xmlparent ref,
int fileid: @file ref int fileid: @file ref
); );
xmlChars( xmlChars(
unique int id: @xmlcharacters, unique int id: @xmlcharacters,
string text: string ref, string text: string ref,
int parentid: @xmlparent ref, int parentid: @xmlparent ref,
int idx: int ref, int idx: int ref,
int isCDATA: int ref, int isCDATA: int ref,
int fileid: @file ref int fileid: @file ref
); );
@xmlparent = @file | @xmlelement; @xmlparent = @file | @xmlelement;
@xmlnamespaceable = @xmlelement | @xmlattribute; @xmlnamespaceable = @xmlelement | @xmlattribute;
xmllocations( xmllocations(
int xmlElement: @xmllocatable ref, int xmlElement: @xmllocatable ref,
int location: @location_default ref int location: @location_default ref
); );
@xmllocatable = @xmlcharacters @xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace;
| @xmlelement
| @xmlcomment
| @xmlattribute
| @xmldtd
| @file
| @xmlnamespace;