mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #17357 from smowton/smowton/feature/go-indistinguishable-types
Go: extract and expose struct tags, interface method IDs
This commit is contained in:
@@ -0,0 +1,546 @@
|
||||
/** Auto-generated dbscheme; do not edit. */
|
||||
|
||||
|
||||
/** Duplicate code **/
|
||||
|
||||
duplicateCode(
|
||||
unique int id : @duplication,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
similarCode(
|
||||
unique int id : @similarity,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
@duplication_or_similarity = @duplication | @similarity;
|
||||
|
||||
tokens(
|
||||
int id : @duplication_or_similarity ref,
|
||||
int offset : int ref,
|
||||
int beginLine : int ref,
|
||||
int beginColumn : int ref,
|
||||
int endLine : int ref,
|
||||
int endColumn : int ref);
|
||||
|
||||
/** External data **/
|
||||
|
||||
externalData(
|
||||
int id : @externalDataElement,
|
||||
varchar(900) path : string ref,
|
||||
int column: int ref,
|
||||
varchar(900) value : string ref
|
||||
);
|
||||
|
||||
snapshotDate(unique date snapshotDate : date ref);
|
||||
|
||||
sourceLocationPrefix(varchar(900) prefix : string ref);
|
||||
|
||||
|
||||
/*
|
||||
* XML Files
|
||||
*/
|
||||
|
||||
xmlEncoding(
|
||||
unique int id: @file ref,
|
||||
string encoding: string ref
|
||||
);
|
||||
|
||||
xmlDTDs(
|
||||
unique int id: @xmldtd,
|
||||
string root: string ref,
|
||||
string publicId: string ref,
|
||||
string systemId: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlElements(
|
||||
unique int id: @xmlelement,
|
||||
string name: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlAttrs(
|
||||
unique int id: @xmlattribute,
|
||||
int elementid: @xmlelement ref,
|
||||
string name: string ref,
|
||||
string value: string ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlNs(
|
||||
int id: @xmlnamespace,
|
||||
string prefixName: string ref,
|
||||
string URI: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlHasNs(
|
||||
int elementId: @xmlnamespaceable ref,
|
||||
int nsId: @xmlnamespace ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlComments(
|
||||
unique int id: @xmlcomment,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlChars(
|
||||
unique int id: @xmlcharacters,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int isCDATA: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
@xmlparent = @file | @xmlelement;
|
||||
@xmlnamespaceable = @xmlelement | @xmlattribute;
|
||||
|
||||
xmllocations(
|
||||
int xmlElement: @xmllocatable ref,
|
||||
int location: @location_default ref
|
||||
);
|
||||
|
||||
@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace;
|
||||
|
||||
compilations(unique int id: @compilation, string cwd: string ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_args(int id: @compilation ref, int num: int ref, string arg: string ref);
|
||||
|
||||
#keyset[id, num, kind]
|
||||
compilation_time(int id: @compilation ref, int num: int ref, int kind: int ref, float secs: float ref);
|
||||
|
||||
diagnostic_for(unique int diagnostic: @diagnostic ref, int compilation: @compilation ref, int file_number: int ref, int file_number_diagnostic_number: int ref);
|
||||
|
||||
compilation_finished(unique int id: @compilation ref, float cpu_seconds: float ref, float elapsed_seconds: float ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_compiling_files(int id: @compilation ref, int num: int ref, int file: @file 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);
|
||||
|
||||
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);
|
||||
|
||||
numlines(int element_id: @sourceline ref, int num_lines: int ref, int num_code: int ref, int num_comment: int ref);
|
||||
|
||||
files(unique int id: @file, string name: string ref);
|
||||
|
||||
folders(unique int id: @folder, string name: string ref);
|
||||
|
||||
containerparent(int parent: @container ref, unique int child: @container ref);
|
||||
|
||||
has_location(unique int locatable: @locatable ref, int location: @location ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
comment_groups(unique int id: @comment_group, int parent: @file ref, int idx: int ref);
|
||||
|
||||
comments(unique int id: @comment, int kind: int ref, int parent: @comment_group ref, int idx: int ref, string text: string ref);
|
||||
|
||||
doc_comments(unique int node: @documentable ref, int comment: @comment_group ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
exprs(unique int id: @expr, int kind: int ref, int parent: @exprparent ref, int idx: int ref);
|
||||
|
||||
literals(unique int expr: @expr ref, string value: string ref, string raw: string ref);
|
||||
|
||||
constvalues(unique int expr: @expr ref, string value: string ref, string exact: string ref);
|
||||
|
||||
fields(unique int id: @field, int parent: @fieldparent ref, int idx: int ref);
|
||||
|
||||
typeparamdecls(unique int id: @typeparamdecl, int parent: @typeparamdeclparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
stmts(unique int id: @stmt, int kind: int ref, int parent: @stmtparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
decls(unique int id: @decl, int kind: int ref, int parent: @declparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
specs(unique int id: @spec, int kind: int ref, int parent: @gendecl ref, int idx: int ref);
|
||||
|
||||
scopes(unique int id: @scope, int kind: int ref);
|
||||
|
||||
scopenesting(unique int inner: @scope ref, int outer: @scope ref);
|
||||
|
||||
scopenodes(unique int node: @scopenode ref, int scope: @localscope ref);
|
||||
|
||||
objects(unique int id: @object, int kind: int ref, string name: string ref);
|
||||
|
||||
objectscopes(unique int object: @object ref, int scope: @scope ref);
|
||||
|
||||
objecttypes(unique int object: @object ref, int tp: @type ref);
|
||||
|
||||
methodreceivers(unique int method: @object ref, int receiver: @object ref);
|
||||
|
||||
fieldstructs(unique int field: @object ref, int struct: @structtype ref);
|
||||
|
||||
methodhosts(int method: @object ref, int host: @namedtype ref);
|
||||
|
||||
defs(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
uses(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
types(unique int id: @type, int kind: int ref);
|
||||
|
||||
type_of(unique int expr: @expr ref, int tp: @type ref);
|
||||
|
||||
typename(unique int tp: @type ref, string name: string ref);
|
||||
|
||||
key_type(unique int map: @maptype ref, int tp: @type ref);
|
||||
|
||||
element_type(unique int container: @containertype ref, int tp: @type ref);
|
||||
|
||||
base_type(unique int ptr: @pointertype ref, int tp: @type ref);
|
||||
|
||||
underlying_type(unique int named: @namedtype ref, int tp: @type ref);
|
||||
|
||||
#keyset[parent, index]
|
||||
component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref);
|
||||
|
||||
array_length(unique int tp: @arraytype ref, string len: string ref);
|
||||
|
||||
type_objects(unique int tp: @type ref, int object: @object ref);
|
||||
|
||||
packages(unique int id: @package, string name: string ref, string path: string ref, int scope: @packagescope ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modexprs(unique int id: @modexpr, int kind: int ref, int parent: @modexprparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modtokens(string token: string ref, int parent: @modexpr ref, int idx: int ref);
|
||||
|
||||
#keyset[package, idx]
|
||||
errors(unique int id: @error, int kind: int ref, string msg: string ref, string rawpos: string ref,
|
||||
string file: string ref, int line: int ref, int col: int ref, int package: @package ref, int idx: int ref);
|
||||
|
||||
has_ellipsis(int id: @callorconversionexpr ref);
|
||||
|
||||
variadic(int id: @signaturetype ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
typeparam(unique int tp: @typeparamtype ref, string name: string ref, int bound: @compositetype ref,
|
||||
int parent: @typeparamparentobject ref, int idx: int ref);
|
||||
|
||||
@container = @file | @folder;
|
||||
|
||||
@locatable = @xmllocatable | @node | @localscope;
|
||||
|
||||
@node = @documentable | @exprparent | @modexprparent | @fieldparent | @stmtparent | @declparent | @typeparamdeclparent
|
||||
| @scopenode | @comment_group | @comment;
|
||||
|
||||
@documentable = @file | @field | @typeparamdecl | @spec | @gendecl | @funcdecl | @modexpr;
|
||||
|
||||
@exprparent = @funcdef | @file | @expr | @field | @stmt | @decl | @typeparamdecl | @spec;
|
||||
|
||||
@modexprparent = @file | @modexpr;
|
||||
|
||||
@fieldparent = @decl | @structtypeexpr | @functypeexpr | @interfacetypeexpr;
|
||||
|
||||
@stmtparent = @funcdef | @stmt | @decl;
|
||||
|
||||
@declparent = @file | @declstmt;
|
||||
|
||||
@typeparamdeclparent = @funcdecl | @typespec;
|
||||
|
||||
@funcdef = @funclit | @funcdecl;
|
||||
|
||||
@scopenode = @file | @functypeexpr | @blockstmt | @ifstmt | @caseclause | @switchstmt | @commclause | @loopstmt;
|
||||
|
||||
@location = @location_default;
|
||||
|
||||
@sourceline = @locatable;
|
||||
|
||||
case @comment.kind of
|
||||
0 = @slashslashcomment
|
||||
| 1 = @slashstarcomment;
|
||||
|
||||
case @expr.kind of
|
||||
0 = @badexpr
|
||||
| 1 = @ident
|
||||
| 2 = @ellipsis
|
||||
| 3 = @intlit
|
||||
| 4 = @floatlit
|
||||
| 5 = @imaglit
|
||||
| 6 = @charlit
|
||||
| 7 = @stringlit
|
||||
| 8 = @funclit
|
||||
| 9 = @compositelit
|
||||
| 10 = @parenexpr
|
||||
| 11 = @selectorexpr
|
||||
| 12 = @indexexpr
|
||||
| 13 = @genericfunctioninstantiationexpr
|
||||
| 14 = @generictypeinstantiationexpr
|
||||
| 15 = @sliceexpr
|
||||
| 16 = @typeassertexpr
|
||||
| 17 = @callorconversionexpr
|
||||
| 18 = @starexpr
|
||||
| 19 = @keyvalueexpr
|
||||
| 20 = @arraytypeexpr
|
||||
| 21 = @structtypeexpr
|
||||
| 22 = @functypeexpr
|
||||
| 23 = @interfacetypeexpr
|
||||
| 24 = @maptypeexpr
|
||||
| 25 = @typesetliteralexpr
|
||||
| 26 = @plusexpr
|
||||
| 27 = @minusexpr
|
||||
| 28 = @notexpr
|
||||
| 29 = @complementexpr
|
||||
| 30 = @derefexpr
|
||||
| 31 = @addressexpr
|
||||
| 32 = @arrowexpr
|
||||
| 33 = @lorexpr
|
||||
| 34 = @landexpr
|
||||
| 35 = @eqlexpr
|
||||
| 36 = @neqexpr
|
||||
| 37 = @lssexpr
|
||||
| 38 = @leqexpr
|
||||
| 39 = @gtrexpr
|
||||
| 40 = @geqexpr
|
||||
| 41 = @addexpr
|
||||
| 42 = @subexpr
|
||||
| 43 = @orexpr
|
||||
| 44 = @xorexpr
|
||||
| 45 = @mulexpr
|
||||
| 46 = @quoexpr
|
||||
| 47 = @remexpr
|
||||
| 48 = @shlexpr
|
||||
| 49 = @shrexpr
|
||||
| 50 = @andexpr
|
||||
| 51 = @andnotexpr
|
||||
| 52 = @sendchantypeexpr
|
||||
| 53 = @recvchantypeexpr
|
||||
| 54 = @sendrcvchantypeexpr;
|
||||
|
||||
@basiclit = @intlit | @floatlit | @imaglit | @charlit | @stringlit;
|
||||
|
||||
@operatorexpr = @logicalexpr | @arithmeticexpr | @bitwiseexpr | @unaryexpr | @binaryexpr;
|
||||
|
||||
@logicalexpr = @logicalunaryexpr | @logicalbinaryexpr;
|
||||
|
||||
@arithmeticexpr = @arithmeticunaryexpr | @arithmeticbinaryexpr;
|
||||
|
||||
@bitwiseexpr = @bitwiseunaryexpr | @bitwisebinaryexpr;
|
||||
|
||||
@unaryexpr = @logicalunaryexpr | @bitwiseunaryexpr | @arithmeticunaryexpr | @derefexpr | @addressexpr | @arrowexpr;
|
||||
|
||||
@logicalunaryexpr = @notexpr;
|
||||
|
||||
@bitwiseunaryexpr = @complementexpr;
|
||||
|
||||
@arithmeticunaryexpr = @plusexpr | @minusexpr;
|
||||
|
||||
@binaryexpr = @logicalbinaryexpr | @bitwisebinaryexpr | @arithmeticbinaryexpr | @comparison;
|
||||
|
||||
@logicalbinaryexpr = @lorexpr | @landexpr;
|
||||
|
||||
@bitwisebinaryexpr = @shiftexpr | @orexpr | @xorexpr | @andexpr | @andnotexpr;
|
||||
|
||||
@arithmeticbinaryexpr = @addexpr | @subexpr | @mulexpr | @quoexpr | @remexpr;
|
||||
|
||||
@shiftexpr = @shlexpr | @shrexpr;
|
||||
|
||||
@comparison = @equalitytest | @relationalcomparison;
|
||||
|
||||
@equalitytest = @eqlexpr | @neqexpr;
|
||||
|
||||
@relationalcomparison = @lssexpr | @leqexpr | @gtrexpr | @geqexpr;
|
||||
|
||||
@chantypeexpr = @sendchantypeexpr | @recvchantypeexpr | @sendrcvchantypeexpr;
|
||||
|
||||
case @stmt.kind of
|
||||
0 = @badstmt
|
||||
| 1 = @declstmt
|
||||
| 2 = @emptystmt
|
||||
| 3 = @labeledstmt
|
||||
| 4 = @exprstmt
|
||||
| 5 = @sendstmt
|
||||
| 6 = @incstmt
|
||||
| 7 = @decstmt
|
||||
| 8 = @gostmt
|
||||
| 9 = @deferstmt
|
||||
| 10 = @returnstmt
|
||||
| 11 = @breakstmt
|
||||
| 12 = @continuestmt
|
||||
| 13 = @gotostmt
|
||||
| 14 = @fallthroughstmt
|
||||
| 15 = @blockstmt
|
||||
| 16 = @ifstmt
|
||||
| 17 = @caseclause
|
||||
| 18 = @exprswitchstmt
|
||||
| 19 = @typeswitchstmt
|
||||
| 20 = @commclause
|
||||
| 21 = @selectstmt
|
||||
| 22 = @forstmt
|
||||
| 23 = @rangestmt
|
||||
| 24 = @assignstmt
|
||||
| 25 = @definestmt
|
||||
| 26 = @addassignstmt
|
||||
| 27 = @subassignstmt
|
||||
| 28 = @mulassignstmt
|
||||
| 29 = @quoassignstmt
|
||||
| 30 = @remassignstmt
|
||||
| 31 = @andassignstmt
|
||||
| 32 = @orassignstmt
|
||||
| 33 = @xorassignstmt
|
||||
| 34 = @shlassignstmt
|
||||
| 35 = @shrassignstmt
|
||||
| 36 = @andnotassignstmt;
|
||||
|
||||
@incdecstmt = @incstmt | @decstmt;
|
||||
|
||||
@assignment = @simpleassignstmt | @compoundassignstmt;
|
||||
|
||||
@simpleassignstmt = @assignstmt | @definestmt;
|
||||
|
||||
@compoundassignstmt = @addassignstmt | @subassignstmt | @mulassignstmt | @quoassignstmt | @remassignstmt
|
||||
| @andassignstmt | @orassignstmt | @xorassignstmt | @shlassignstmt | @shrassignstmt | @andnotassignstmt;
|
||||
|
||||
@branchstmt = @breakstmt | @continuestmt | @gotostmt | @fallthroughstmt;
|
||||
|
||||
@switchstmt = @exprswitchstmt | @typeswitchstmt;
|
||||
|
||||
@loopstmt = @forstmt | @rangestmt;
|
||||
|
||||
case @decl.kind of
|
||||
0 = @baddecl
|
||||
| 1 = @importdecl
|
||||
| 2 = @constdecl
|
||||
| 3 = @typedecl
|
||||
| 4 = @vardecl
|
||||
| 5 = @funcdecl;
|
||||
|
||||
@gendecl = @importdecl | @constdecl | @typedecl | @vardecl;
|
||||
|
||||
case @spec.kind of
|
||||
0 = @importspec
|
||||
| 1 = @valuespec
|
||||
| 2 = @typedefspec
|
||||
| 3 = @aliasspec;
|
||||
|
||||
@typespec = @typedefspec | @aliasspec;
|
||||
|
||||
case @object.kind of
|
||||
0 = @pkgobject
|
||||
| 1 = @decltypeobject
|
||||
| 2 = @builtintypeobject
|
||||
| 3 = @declconstobject
|
||||
| 4 = @builtinconstobject
|
||||
| 5 = @declvarobject
|
||||
| 6 = @declfunctionobject
|
||||
| 7 = @builtinfunctionobject
|
||||
| 8 = @labelobject;
|
||||
|
||||
@typeparamparentobject = @decltypeobject | @declfunctionobject;
|
||||
|
||||
@declobject = @decltypeobject | @declconstobject | @declvarobject | @declfunctionobject;
|
||||
|
||||
@builtinobject = @builtintypeobject | @builtinconstobject | @builtinfunctionobject;
|
||||
|
||||
@typeobject = @decltypeobject | @builtintypeobject;
|
||||
|
||||
@valueobject = @constobject | @varobject | @functionobject;
|
||||
|
||||
@constobject = @declconstobject | @builtinconstobject;
|
||||
|
||||
@varobject = @declvarobject;
|
||||
|
||||
@functionobject = @declfunctionobject | @builtinfunctionobject;
|
||||
|
||||
case @scope.kind of
|
||||
0 = @universescope
|
||||
| 1 = @packagescope
|
||||
| 2 = @localscope;
|
||||
|
||||
case @type.kind of
|
||||
0 = @invalidtype
|
||||
| 1 = @boolexprtype
|
||||
| 2 = @inttype
|
||||
| 3 = @int8type
|
||||
| 4 = @int16type
|
||||
| 5 = @int32type
|
||||
| 6 = @int64type
|
||||
| 7 = @uinttype
|
||||
| 8 = @uint8type
|
||||
| 9 = @uint16type
|
||||
| 10 = @uint32type
|
||||
| 11 = @uint64type
|
||||
| 12 = @uintptrtype
|
||||
| 13 = @float32type
|
||||
| 14 = @float64type
|
||||
| 15 = @complex64type
|
||||
| 16 = @complex128type
|
||||
| 17 = @stringexprtype
|
||||
| 18 = @unsafepointertype
|
||||
| 19 = @boolliteraltype
|
||||
| 20 = @intliteraltype
|
||||
| 21 = @runeliteraltype
|
||||
| 22 = @floatliteraltype
|
||||
| 23 = @complexliteraltype
|
||||
| 24 = @stringliteraltype
|
||||
| 25 = @nilliteraltype
|
||||
| 26 = @typeparamtype
|
||||
| 27 = @arraytype
|
||||
| 28 = @slicetype
|
||||
| 29 = @structtype
|
||||
| 30 = @pointertype
|
||||
| 31 = @interfacetype
|
||||
| 32 = @tupletype
|
||||
| 33 = @signaturetype
|
||||
| 34 = @maptype
|
||||
| 35 = @sendchantype
|
||||
| 36 = @recvchantype
|
||||
| 37 = @sendrcvchantype
|
||||
| 38 = @namedtype
|
||||
| 39 = @typesetliteraltype;
|
||||
|
||||
@basictype = @booltype | @numerictype | @stringtype | @literaltype | @invalidtype | @unsafepointertype;
|
||||
|
||||
@booltype = @boolexprtype | @boolliteraltype;
|
||||
|
||||
@numerictype = @integertype | @floattype | @complextype;
|
||||
|
||||
@integertype = @signedintegertype | @unsignedintegertype;
|
||||
|
||||
@signedintegertype = @inttype | @int8type | @int16type | @int32type | @int64type | @intliteraltype | @runeliteraltype;
|
||||
|
||||
@unsignedintegertype = @uinttype | @uint8type | @uint16type | @uint32type | @uint64type | @uintptrtype;
|
||||
|
||||
@floattype = @float32type | @float64type | @floatliteraltype;
|
||||
|
||||
@complextype = @complex64type | @complex128type | @complexliteraltype;
|
||||
|
||||
@stringtype = @stringexprtype | @stringliteraltype;
|
||||
|
||||
@literaltype = @boolliteraltype | @intliteraltype | @runeliteraltype | @floatliteraltype | @complexliteraltype
|
||||
| @stringliteraltype | @nilliteraltype;
|
||||
|
||||
@compositetype = @typeparamtype | @containertype | @structtype | @pointertype | @interfacetype | @tupletype
|
||||
| @signaturetype | @namedtype | @typesetliteraltype;
|
||||
|
||||
@containertype = @arraytype | @slicetype | @maptype | @chantype;
|
||||
|
||||
@chantype = @sendchantype | @recvchantype | @sendrcvchantype;
|
||||
|
||||
case @modexpr.kind of
|
||||
0 = @modcommentblock
|
||||
| 1 = @modline
|
||||
| 2 = @modlineblock
|
||||
| 3 = @modlparen
|
||||
| 4 = @modrparen;
|
||||
|
||||
case @error.kind of
|
||||
0 = @unknownerror
|
||||
| 1 = @listerror
|
||||
| 2 = @parseerror
|
||||
| 3 = @typeerror;
|
||||
|
||||
@@ -0,0 +1,552 @@
|
||||
/** Auto-generated dbscheme; do not edit. Run `make gen` in directory `go/` to regenerate. */
|
||||
|
||||
|
||||
/** Duplicate code **/
|
||||
|
||||
duplicateCode(
|
||||
unique int id : @duplication,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
similarCode(
|
||||
unique int id : @similarity,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
@duplication_or_similarity = @duplication | @similarity;
|
||||
|
||||
tokens(
|
||||
int id : @duplication_or_similarity ref,
|
||||
int offset : int ref,
|
||||
int beginLine : int ref,
|
||||
int beginColumn : int ref,
|
||||
int endLine : int ref,
|
||||
int endColumn : int ref);
|
||||
|
||||
/** External data **/
|
||||
|
||||
externalData(
|
||||
int id : @externalDataElement,
|
||||
varchar(900) path : string ref,
|
||||
int column: int ref,
|
||||
varchar(900) value : string ref
|
||||
);
|
||||
|
||||
snapshotDate(unique date snapshotDate : date ref);
|
||||
|
||||
sourceLocationPrefix(varchar(900) prefix : string ref);
|
||||
|
||||
|
||||
/*
|
||||
* XML Files
|
||||
*/
|
||||
|
||||
xmlEncoding(
|
||||
unique int id: @file ref,
|
||||
string encoding: string ref
|
||||
);
|
||||
|
||||
xmlDTDs(
|
||||
unique int id: @xmldtd,
|
||||
string root: string ref,
|
||||
string publicId: string ref,
|
||||
string systemId: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlElements(
|
||||
unique int id: @xmlelement,
|
||||
string name: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlAttrs(
|
||||
unique int id: @xmlattribute,
|
||||
int elementid: @xmlelement ref,
|
||||
string name: string ref,
|
||||
string value: string ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlNs(
|
||||
int id: @xmlnamespace,
|
||||
string prefixName: string ref,
|
||||
string URI: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlHasNs(
|
||||
int elementId: @xmlnamespaceable ref,
|
||||
int nsId: @xmlnamespace ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlComments(
|
||||
unique int id: @xmlcomment,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlChars(
|
||||
unique int id: @xmlcharacters,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int isCDATA: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
@xmlparent = @file | @xmlelement;
|
||||
@xmlnamespaceable = @xmlelement | @xmlattribute;
|
||||
|
||||
xmllocations(
|
||||
int xmlElement: @xmllocatable ref,
|
||||
int location: @location_default ref
|
||||
);
|
||||
|
||||
@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace;
|
||||
|
||||
compilations(unique int id: @compilation, string cwd: string ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_args(int id: @compilation ref, int num: int ref, string arg: string ref);
|
||||
|
||||
#keyset[id, num, kind]
|
||||
compilation_time(int id: @compilation ref, int num: int ref, int kind: int ref, float secs: float ref);
|
||||
|
||||
diagnostic_for(unique int diagnostic: @diagnostic ref, int compilation: @compilation ref, int file_number: int ref, int file_number_diagnostic_number: int ref);
|
||||
|
||||
compilation_finished(unique int id: @compilation ref, float cpu_seconds: float ref, float elapsed_seconds: float ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_compiling_files(int id: @compilation ref, int num: int ref, int file: @file 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);
|
||||
|
||||
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);
|
||||
|
||||
numlines(int element_id: @sourceline ref, int num_lines: int ref, int num_code: int ref, int num_comment: int ref);
|
||||
|
||||
files(unique int id: @file, string name: string ref);
|
||||
|
||||
folders(unique int id: @folder, string name: string ref);
|
||||
|
||||
containerparent(int parent: @container ref, unique int child: @container ref);
|
||||
|
||||
has_location(unique int locatable: @locatable ref, int location: @location ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
comment_groups(unique int id: @comment_group, int parent: @file ref, int idx: int ref);
|
||||
|
||||
comments(unique int id: @comment, int kind: int ref, int parent: @comment_group ref, int idx: int ref, string text: string ref);
|
||||
|
||||
doc_comments(unique int node: @documentable ref, int comment: @comment_group ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
exprs(unique int id: @expr, int kind: int ref, int parent: @exprparent ref, int idx: int ref);
|
||||
|
||||
literals(unique int expr: @expr ref, string value: string ref, string raw: string ref);
|
||||
|
||||
constvalues(unique int expr: @expr ref, string value: string ref, string exact: string ref);
|
||||
|
||||
fields(unique int id: @field, int parent: @fieldparent ref, int idx: int ref);
|
||||
|
||||
typeparamdecls(unique int id: @typeparamdecl, int parent: @typeparamdeclparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
stmts(unique int id: @stmt, int kind: int ref, int parent: @stmtparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
decls(unique int id: @decl, int kind: int ref, int parent: @declparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
specs(unique int id: @spec, int kind: int ref, int parent: @gendecl ref, int idx: int ref);
|
||||
|
||||
scopes(unique int id: @scope, int kind: int ref);
|
||||
|
||||
scopenesting(unique int inner: @scope ref, int outer: @scope ref);
|
||||
|
||||
scopenodes(unique int node: @scopenode ref, int scope: @localscope ref);
|
||||
|
||||
objects(unique int id: @object, int kind: int ref, string name: string ref);
|
||||
|
||||
objectscopes(unique int object: @object ref, int scope: @scope ref);
|
||||
|
||||
objecttypes(unique int object: @object ref, int tp: @type ref);
|
||||
|
||||
methodreceivers(unique int method: @object ref, int receiver: @object ref);
|
||||
|
||||
fieldstructs(unique int field: @object ref, int struct: @structtype ref);
|
||||
|
||||
methodhosts(int method: @object ref, int host: @namedtype ref);
|
||||
|
||||
defs(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
uses(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
types(unique int id: @type, int kind: int ref);
|
||||
|
||||
type_of(unique int expr: @expr ref, int tp: @type ref);
|
||||
|
||||
typename(unique int tp: @type ref, string name: string ref);
|
||||
|
||||
key_type(unique int map: @maptype ref, int tp: @type ref);
|
||||
|
||||
element_type(unique int container: @containertype ref, int tp: @type ref);
|
||||
|
||||
base_type(unique int ptr: @pointertype ref, int tp: @type ref);
|
||||
|
||||
underlying_type(unique int named: @namedtype ref, int tp: @type ref);
|
||||
|
||||
#keyset[parent, index]
|
||||
component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref);
|
||||
|
||||
#keyset[parent, index]
|
||||
struct_tags(int parent: @structtype ref, int index: int ref, string tag: string ref);
|
||||
|
||||
#keyset[interface, index]
|
||||
interface_private_method_ids(int interface: @interfacetype ref, int index: int ref, string id: string ref);
|
||||
|
||||
array_length(unique int tp: @arraytype ref, string len: string ref);
|
||||
|
||||
type_objects(unique int tp: @type ref, int object: @object ref);
|
||||
|
||||
packages(unique int id: @package, string name: string ref, string path: string ref, int scope: @packagescope ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modexprs(unique int id: @modexpr, int kind: int ref, int parent: @modexprparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modtokens(string token: string ref, int parent: @modexpr ref, int idx: int ref);
|
||||
|
||||
#keyset[package, idx]
|
||||
errors(unique int id: @error, int kind: int ref, string msg: string ref, string rawpos: string ref,
|
||||
string file: string ref, int line: int ref, int col: int ref, int package: @package ref, int idx: int ref);
|
||||
|
||||
has_ellipsis(int id: @callorconversionexpr ref);
|
||||
|
||||
variadic(int id: @signaturetype ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
typeparam(unique int tp: @typeparamtype ref, string name: string ref, int bound: @compositetype ref,
|
||||
int parent: @typeparamparentobject ref, int idx: int ref);
|
||||
|
||||
@container = @file | @folder;
|
||||
|
||||
@locatable = @xmllocatable | @node | @localscope;
|
||||
|
||||
@node = @documentable | @exprparent | @modexprparent | @fieldparent | @stmtparent | @declparent | @typeparamdeclparent
|
||||
| @scopenode | @comment_group | @comment;
|
||||
|
||||
@documentable = @file | @field | @typeparamdecl | @spec | @gendecl | @funcdecl | @modexpr;
|
||||
|
||||
@exprparent = @funcdef | @file | @expr | @field | @stmt | @decl | @typeparamdecl | @spec;
|
||||
|
||||
@modexprparent = @file | @modexpr;
|
||||
|
||||
@fieldparent = @decl | @structtypeexpr | @functypeexpr | @interfacetypeexpr;
|
||||
|
||||
@stmtparent = @funcdef | @stmt | @decl;
|
||||
|
||||
@declparent = @file | @declstmt;
|
||||
|
||||
@typeparamdeclparent = @funcdecl | @typespec;
|
||||
|
||||
@funcdef = @funclit | @funcdecl;
|
||||
|
||||
@scopenode = @file | @functypeexpr | @blockstmt | @ifstmt | @caseclause | @switchstmt | @commclause | @loopstmt;
|
||||
|
||||
@location = @location_default;
|
||||
|
||||
@sourceline = @locatable;
|
||||
|
||||
case @comment.kind of
|
||||
0 = @slashslashcomment
|
||||
| 1 = @slashstarcomment;
|
||||
|
||||
case @expr.kind of
|
||||
0 = @badexpr
|
||||
| 1 = @ident
|
||||
| 2 = @ellipsis
|
||||
| 3 = @intlit
|
||||
| 4 = @floatlit
|
||||
| 5 = @imaglit
|
||||
| 6 = @charlit
|
||||
| 7 = @stringlit
|
||||
| 8 = @funclit
|
||||
| 9 = @compositelit
|
||||
| 10 = @parenexpr
|
||||
| 11 = @selectorexpr
|
||||
| 12 = @indexexpr
|
||||
| 13 = @genericfunctioninstantiationexpr
|
||||
| 14 = @generictypeinstantiationexpr
|
||||
| 15 = @sliceexpr
|
||||
| 16 = @typeassertexpr
|
||||
| 17 = @callorconversionexpr
|
||||
| 18 = @starexpr
|
||||
| 19 = @keyvalueexpr
|
||||
| 20 = @arraytypeexpr
|
||||
| 21 = @structtypeexpr
|
||||
| 22 = @functypeexpr
|
||||
| 23 = @interfacetypeexpr
|
||||
| 24 = @maptypeexpr
|
||||
| 25 = @typesetliteralexpr
|
||||
| 26 = @plusexpr
|
||||
| 27 = @minusexpr
|
||||
| 28 = @notexpr
|
||||
| 29 = @complementexpr
|
||||
| 30 = @derefexpr
|
||||
| 31 = @addressexpr
|
||||
| 32 = @arrowexpr
|
||||
| 33 = @lorexpr
|
||||
| 34 = @landexpr
|
||||
| 35 = @eqlexpr
|
||||
| 36 = @neqexpr
|
||||
| 37 = @lssexpr
|
||||
| 38 = @leqexpr
|
||||
| 39 = @gtrexpr
|
||||
| 40 = @geqexpr
|
||||
| 41 = @addexpr
|
||||
| 42 = @subexpr
|
||||
| 43 = @orexpr
|
||||
| 44 = @xorexpr
|
||||
| 45 = @mulexpr
|
||||
| 46 = @quoexpr
|
||||
| 47 = @remexpr
|
||||
| 48 = @shlexpr
|
||||
| 49 = @shrexpr
|
||||
| 50 = @andexpr
|
||||
| 51 = @andnotexpr
|
||||
| 52 = @sendchantypeexpr
|
||||
| 53 = @recvchantypeexpr
|
||||
| 54 = @sendrcvchantypeexpr;
|
||||
|
||||
@basiclit = @intlit | @floatlit | @imaglit | @charlit | @stringlit;
|
||||
|
||||
@operatorexpr = @logicalexpr | @arithmeticexpr | @bitwiseexpr | @unaryexpr | @binaryexpr;
|
||||
|
||||
@logicalexpr = @logicalunaryexpr | @logicalbinaryexpr;
|
||||
|
||||
@arithmeticexpr = @arithmeticunaryexpr | @arithmeticbinaryexpr;
|
||||
|
||||
@bitwiseexpr = @bitwiseunaryexpr | @bitwisebinaryexpr;
|
||||
|
||||
@unaryexpr = @logicalunaryexpr | @bitwiseunaryexpr | @arithmeticunaryexpr | @derefexpr | @addressexpr | @arrowexpr;
|
||||
|
||||
@logicalunaryexpr = @notexpr;
|
||||
|
||||
@bitwiseunaryexpr = @complementexpr;
|
||||
|
||||
@arithmeticunaryexpr = @plusexpr | @minusexpr;
|
||||
|
||||
@binaryexpr = @logicalbinaryexpr | @bitwisebinaryexpr | @arithmeticbinaryexpr | @comparison;
|
||||
|
||||
@logicalbinaryexpr = @lorexpr | @landexpr;
|
||||
|
||||
@bitwisebinaryexpr = @shiftexpr | @orexpr | @xorexpr | @andexpr | @andnotexpr;
|
||||
|
||||
@arithmeticbinaryexpr = @addexpr | @subexpr | @mulexpr | @quoexpr | @remexpr;
|
||||
|
||||
@shiftexpr = @shlexpr | @shrexpr;
|
||||
|
||||
@comparison = @equalitytest | @relationalcomparison;
|
||||
|
||||
@equalitytest = @eqlexpr | @neqexpr;
|
||||
|
||||
@relationalcomparison = @lssexpr | @leqexpr | @gtrexpr | @geqexpr;
|
||||
|
||||
@chantypeexpr = @sendchantypeexpr | @recvchantypeexpr | @sendrcvchantypeexpr;
|
||||
|
||||
case @stmt.kind of
|
||||
0 = @badstmt
|
||||
| 1 = @declstmt
|
||||
| 2 = @emptystmt
|
||||
| 3 = @labeledstmt
|
||||
| 4 = @exprstmt
|
||||
| 5 = @sendstmt
|
||||
| 6 = @incstmt
|
||||
| 7 = @decstmt
|
||||
| 8 = @gostmt
|
||||
| 9 = @deferstmt
|
||||
| 10 = @returnstmt
|
||||
| 11 = @breakstmt
|
||||
| 12 = @continuestmt
|
||||
| 13 = @gotostmt
|
||||
| 14 = @fallthroughstmt
|
||||
| 15 = @blockstmt
|
||||
| 16 = @ifstmt
|
||||
| 17 = @caseclause
|
||||
| 18 = @exprswitchstmt
|
||||
| 19 = @typeswitchstmt
|
||||
| 20 = @commclause
|
||||
| 21 = @selectstmt
|
||||
| 22 = @forstmt
|
||||
| 23 = @rangestmt
|
||||
| 24 = @assignstmt
|
||||
| 25 = @definestmt
|
||||
| 26 = @addassignstmt
|
||||
| 27 = @subassignstmt
|
||||
| 28 = @mulassignstmt
|
||||
| 29 = @quoassignstmt
|
||||
| 30 = @remassignstmt
|
||||
| 31 = @andassignstmt
|
||||
| 32 = @orassignstmt
|
||||
| 33 = @xorassignstmt
|
||||
| 34 = @shlassignstmt
|
||||
| 35 = @shrassignstmt
|
||||
| 36 = @andnotassignstmt;
|
||||
|
||||
@incdecstmt = @incstmt | @decstmt;
|
||||
|
||||
@assignment = @simpleassignstmt | @compoundassignstmt;
|
||||
|
||||
@simpleassignstmt = @assignstmt | @definestmt;
|
||||
|
||||
@compoundassignstmt = @addassignstmt | @subassignstmt | @mulassignstmt | @quoassignstmt | @remassignstmt
|
||||
| @andassignstmt | @orassignstmt | @xorassignstmt | @shlassignstmt | @shrassignstmt | @andnotassignstmt;
|
||||
|
||||
@branchstmt = @breakstmt | @continuestmt | @gotostmt | @fallthroughstmt;
|
||||
|
||||
@switchstmt = @exprswitchstmt | @typeswitchstmt;
|
||||
|
||||
@loopstmt = @forstmt | @rangestmt;
|
||||
|
||||
case @decl.kind of
|
||||
0 = @baddecl
|
||||
| 1 = @importdecl
|
||||
| 2 = @constdecl
|
||||
| 3 = @typedecl
|
||||
| 4 = @vardecl
|
||||
| 5 = @funcdecl;
|
||||
|
||||
@gendecl = @importdecl | @constdecl | @typedecl | @vardecl;
|
||||
|
||||
case @spec.kind of
|
||||
0 = @importspec
|
||||
| 1 = @valuespec
|
||||
| 2 = @typedefspec
|
||||
| 3 = @aliasspec;
|
||||
|
||||
@typespec = @typedefspec | @aliasspec;
|
||||
|
||||
case @object.kind of
|
||||
0 = @pkgobject
|
||||
| 1 = @decltypeobject
|
||||
| 2 = @builtintypeobject
|
||||
| 3 = @declconstobject
|
||||
| 4 = @builtinconstobject
|
||||
| 5 = @declvarobject
|
||||
| 6 = @declfunctionobject
|
||||
| 7 = @builtinfunctionobject
|
||||
| 8 = @labelobject;
|
||||
|
||||
@typeparamparentobject = @decltypeobject | @declfunctionobject;
|
||||
|
||||
@declobject = @decltypeobject | @declconstobject | @declvarobject | @declfunctionobject;
|
||||
|
||||
@builtinobject = @builtintypeobject | @builtinconstobject | @builtinfunctionobject;
|
||||
|
||||
@typeobject = @decltypeobject | @builtintypeobject;
|
||||
|
||||
@valueobject = @constobject | @varobject | @functionobject;
|
||||
|
||||
@constobject = @declconstobject | @builtinconstobject;
|
||||
|
||||
@varobject = @declvarobject;
|
||||
|
||||
@functionobject = @declfunctionobject | @builtinfunctionobject;
|
||||
|
||||
case @scope.kind of
|
||||
0 = @universescope
|
||||
| 1 = @packagescope
|
||||
| 2 = @localscope;
|
||||
|
||||
case @type.kind of
|
||||
0 = @invalidtype
|
||||
| 1 = @boolexprtype
|
||||
| 2 = @inttype
|
||||
| 3 = @int8type
|
||||
| 4 = @int16type
|
||||
| 5 = @int32type
|
||||
| 6 = @int64type
|
||||
| 7 = @uinttype
|
||||
| 8 = @uint8type
|
||||
| 9 = @uint16type
|
||||
| 10 = @uint32type
|
||||
| 11 = @uint64type
|
||||
| 12 = @uintptrtype
|
||||
| 13 = @float32type
|
||||
| 14 = @float64type
|
||||
| 15 = @complex64type
|
||||
| 16 = @complex128type
|
||||
| 17 = @stringexprtype
|
||||
| 18 = @unsafepointertype
|
||||
| 19 = @boolliteraltype
|
||||
| 20 = @intliteraltype
|
||||
| 21 = @runeliteraltype
|
||||
| 22 = @floatliteraltype
|
||||
| 23 = @complexliteraltype
|
||||
| 24 = @stringliteraltype
|
||||
| 25 = @nilliteraltype
|
||||
| 26 = @typeparamtype
|
||||
| 27 = @arraytype
|
||||
| 28 = @slicetype
|
||||
| 29 = @structtype
|
||||
| 30 = @pointertype
|
||||
| 31 = @interfacetype
|
||||
| 32 = @tupletype
|
||||
| 33 = @signaturetype
|
||||
| 34 = @maptype
|
||||
| 35 = @sendchantype
|
||||
| 36 = @recvchantype
|
||||
| 37 = @sendrcvchantype
|
||||
| 38 = @namedtype
|
||||
| 39 = @typesetliteraltype;
|
||||
|
||||
@basictype = @booltype | @numerictype | @stringtype | @literaltype | @invalidtype | @unsafepointertype;
|
||||
|
||||
@booltype = @boolexprtype | @boolliteraltype;
|
||||
|
||||
@numerictype = @integertype | @floattype | @complextype;
|
||||
|
||||
@integertype = @signedintegertype | @unsignedintegertype;
|
||||
|
||||
@signedintegertype = @inttype | @int8type | @int16type | @int32type | @int64type | @intliteraltype | @runeliteraltype;
|
||||
|
||||
@unsignedintegertype = @uinttype | @uint8type | @uint16type | @uint32type | @uint64type | @uintptrtype;
|
||||
|
||||
@floattype = @float32type | @float64type | @floatliteraltype;
|
||||
|
||||
@complextype = @complex64type | @complex128type | @complexliteraltype;
|
||||
|
||||
@stringtype = @stringexprtype | @stringliteraltype;
|
||||
|
||||
@literaltype = @boolliteraltype | @intliteraltype | @runeliteraltype | @floatliteraltype | @complexliteraltype
|
||||
| @stringliteraltype | @nilliteraltype;
|
||||
|
||||
@compositetype = @typeparamtype | @containertype | @structtype | @pointertype | @interfacetype | @tupletype
|
||||
| @signaturetype | @namedtype | @typesetliteraltype;
|
||||
|
||||
@containertype = @arraytype | @slicetype | @maptype | @chantype;
|
||||
|
||||
@chantype = @sendchantype | @recvchantype | @sendrcvchantype;
|
||||
|
||||
case @modexpr.kind of
|
||||
0 = @modcommentblock
|
||||
| 1 = @modline
|
||||
| 2 = @modlineblock
|
||||
| 3 = @modlparen
|
||||
| 4 = @modrparen;
|
||||
|
||||
case @error.kind of
|
||||
0 = @unknownerror
|
||||
| 1 = @listerror
|
||||
| 2 = @parseerror
|
||||
| 3 = @typeerror;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
description: Remove component-tags and interface-method-id tables
|
||||
compatibility: full
|
||||
|
||||
struct_tags.rel: delete
|
||||
interface_private_method_ids.rel: delete
|
||||
@@ -410,7 +410,7 @@ func AddDefaultSnippet(snippet string) bool {
|
||||
|
||||
// PrintDbScheme prints the schema of this database to the writer `w`
|
||||
func PrintDbScheme(w io.Writer) {
|
||||
fmt.Fprintf(w, "/** Auto-generated dbscheme; do not edit. */\n\n")
|
||||
fmt.Fprintf(w, "/** Auto-generated dbscheme; do not edit. Run `make gen` in directory `go/` to regenerate. */\n\n")
|
||||
for _, snippet := range defaultSnippets {
|
||||
fmt.Fprintf(w, "%s\n", snippet)
|
||||
}
|
||||
|
||||
@@ -1150,6 +1150,20 @@ var ComponentTypesTable = NewTable("component_types",
|
||||
EntityColumn(TypeType, "tp"),
|
||||
).KeySet("parent", "index")
|
||||
|
||||
// StructTagsTable is the table associating struct types with their component types' tags
|
||||
var StructTagsTable = NewTable("struct_tags",
|
||||
EntityColumn(StructType, "parent"),
|
||||
IntColumn("index"),
|
||||
StringColumn("tag"),
|
||||
).KeySet("parent", "index")
|
||||
|
||||
// InterfacePrivateMethodIdsTable is the table associating interface types with the indices and ids of their private methods.
|
||||
var InterfacePrivateMethodIdsTable = NewTable("interface_private_method_ids",
|
||||
EntityColumn(InterfaceType, "interface"),
|
||||
IntColumn("index"),
|
||||
StringColumn("id"),
|
||||
).KeySet("interface", "index")
|
||||
|
||||
// ArrayLengthTable is the table associating array types with their length (represented as a string
|
||||
// since Go array lengths are 64-bit and hence do not always fit into a QL integer)
|
||||
var ArrayLengthTable = NewTable("array_length",
|
||||
|
||||
@@ -1624,6 +1624,9 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
|
||||
name = ""
|
||||
}
|
||||
extractComponentType(tw, lbl, i, name, field.Type())
|
||||
if tp.Tag(i) != "" {
|
||||
dbscheme.StructTagsTable.Emit(tw, lbl, i, tp.Tag(i))
|
||||
}
|
||||
}
|
||||
case *types.Pointer:
|
||||
kind = dbscheme.PointerType.Index()
|
||||
@@ -1641,6 +1644,10 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
|
||||
extractMethod(tw, meth)
|
||||
|
||||
extractComponentType(tw, lbl, i, meth.Name(), meth.Type())
|
||||
|
||||
if !meth.Exported() {
|
||||
dbscheme.InterfacePrivateMethodIdsTable.Emit(tw, lbl, i, meth.Id())
|
||||
}
|
||||
}
|
||||
for i := 0; i < tp.NumEmbeddeds(); i++ {
|
||||
component := tp.EmbeddedType(i)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* Added member predicates `StructTag.hasOwnFieldWithTag` and `Field.getTag`, which enable CodeQL queries to examine struct field tags.
|
||||
* Added member predicate `InterfaceType.hasPrivateMethodWithQualifiedName`, which enables CodeQL queries to distinguish interfaces with matching non-exported method names that are declared in different packages, and are therefore incompatible.
|
||||
@@ -1,4 +1,4 @@
|
||||
/** Auto-generated dbscheme; do not edit. */
|
||||
/** Auto-generated dbscheme; do not edit. Run `make gen` in directory `go/` to regenerate. */
|
||||
|
||||
|
||||
/** Duplicate code **/
|
||||
@@ -207,6 +207,12 @@ underlying_type(unique int named: @namedtype ref, int tp: @type ref);
|
||||
#keyset[parent, index]
|
||||
component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref);
|
||||
|
||||
#keyset[parent, index]
|
||||
struct_tags(int parent: @structtype ref, int index: int ref, string tag: string ref);
|
||||
|
||||
#keyset[interface, index]
|
||||
interface_private_method_ids(int interface: @interfacetype ref, int index: int ref, string id: string ref);
|
||||
|
||||
array_length(unique int tp: @arraytype ref, string len: string ref);
|
||||
|
||||
type_objects(unique int tp: @type ref, int object: @object ref);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -79,6 +79,7 @@ class AstNode extends @node, Locatable {
|
||||
}
|
||||
|
||||
/** Gets the innermost function definition to which this AST node belongs, if any. */
|
||||
pragma[nomagic]
|
||||
FuncDef getEnclosingFunction() { result = this.getParent().parentInSameFunction*() }
|
||||
|
||||
/**
|
||||
|
||||
@@ -2098,6 +2098,7 @@ class LabelName extends Name {
|
||||
* may be identified as such, so not all type expressions can be determined by
|
||||
* a bottom-up analysis. In such cases, `isTypeExprTopDown` below is useful.
|
||||
*/
|
||||
pragma[nomagic]
|
||||
private predicate isTypeExprBottomUp(Expr e) {
|
||||
e instanceof TypeName
|
||||
or
|
||||
@@ -2136,6 +2137,7 @@ private predicate isTypeExprBottomUp(Expr e) {
|
||||
* it may be the latter and so this predicate does not consider the expression to be
|
||||
* a type expression.
|
||||
*/
|
||||
pragma[nomagic]
|
||||
private predicate isTypeExprTopDown(Expr e) {
|
||||
e = any(CompositeLit cl).getTypeExpr()
|
||||
or
|
||||
|
||||
@@ -385,6 +385,11 @@ class Field extends Variable {
|
||||
this = base.getField(f)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the tag associated with this field, or the empty string if this field has no tag.
|
||||
*/
|
||||
string getTag() { declaringType.hasOwnFieldWithTag(_, this.getName(), this.getType(), _, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -474,6 +479,13 @@ class Function extends ValueEntity, @functionobject {
|
||||
ResultVariable getAResult() { result = this.getResult(_) }
|
||||
}
|
||||
|
||||
bindingset[m]
|
||||
pragma[inline_late]
|
||||
private Type implementsIncludingInterfaceMethodsCand(Method m, string mname) {
|
||||
result.implements(m.getReceiverType().getUnderlyingType()) and
|
||||
mname = m.getName()
|
||||
}
|
||||
|
||||
/**
|
||||
* A method, that is, a function with a receiver variable, or a function declared in an interface.
|
||||
*
|
||||
@@ -575,9 +587,9 @@ class Method extends Function {
|
||||
predicate implementsIncludingInterfaceMethods(Method m) {
|
||||
this = m
|
||||
or
|
||||
exists(Type t |
|
||||
this = t.getMethod(m.getName()) and
|
||||
t.implements(m.getReceiverType().getUnderlyingType())
|
||||
exists(Type t, string mname |
|
||||
t = implementsIncludingInterfaceMethodsCand(m, mname) and
|
||||
this = t.getMethod(mname)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ class Type extends @type {
|
||||
* is contained in the method set of this type and any type restrictions are
|
||||
* satisfied.
|
||||
*/
|
||||
pragma[nomagic]
|
||||
predicate implements(InterfaceType i) {
|
||||
if i = any(ComparableType comparable).getUnderlyingType()
|
||||
then this.implementsComparable()
|
||||
@@ -457,6 +458,21 @@ class StructType extends @structtype, CompositeType {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if this struct contains a field `name` with type `tp` and tag `tag`;
|
||||
* `isEmbedded` is true if the field is embedded.
|
||||
*
|
||||
* Note that this predicate does not take promoted fields into account.
|
||||
*/
|
||||
predicate hasOwnFieldWithTag(int i, string name, Type tp, boolean isEmbedded, string tag) {
|
||||
this.hasOwnField(i, name, tp, isEmbedded) and
|
||||
(
|
||||
struct_tags(this, i, tag)
|
||||
or
|
||||
not struct_tags(this, i, _) and tag = ""
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a field with the name `name`; `isEmbedded` is true if the field is embedded.
|
||||
*
|
||||
@@ -575,10 +591,15 @@ class StructType extends @structtype, CompositeType {
|
||||
override string pp() {
|
||||
result =
|
||||
"struct { " +
|
||||
concat(int i, string name, Type tp |
|
||||
component_types(this, i, name, tp)
|
||||
concat(int i, string name, Type tp, string tagToPrint |
|
||||
component_types(this, i, name, tp) and
|
||||
(
|
||||
tagToPrint = " `" + any(string tag | struct_tags(this, i, tag)) + "`"
|
||||
or
|
||||
tagToPrint = "" and not struct_tags(this, i, _)
|
||||
)
|
||||
|
|
||||
name + " " + tp.pp(), "; " order by i
|
||||
name + " " + tp.pp() + tagToPrint, "; " order by i
|
||||
) + " }"
|
||||
}
|
||||
|
||||
@@ -747,6 +768,17 @@ class InterfaceType extends @interfacetype, CompositeType {
|
||||
exists(int i | i >= 0 | component_types(this, i, name, result))
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if this interface type has a private method `name`,
|
||||
* with qualified name `qname` and type `type`.
|
||||
*/
|
||||
predicate hasPrivateMethodWithQualifiedName(string name, string qname, Type type) {
|
||||
exists(int i | i >= 0 |
|
||||
component_types(this, i, name, type) and
|
||||
interface_private_method_ids(this, i, qname)
|
||||
)
|
||||
}
|
||||
|
||||
override predicate hasMethod(string m, SignatureType t) { t = this.getMethodType(m) }
|
||||
|
||||
/**
|
||||
@@ -1032,10 +1064,19 @@ class ErrorType extends Type {
|
||||
ErrorType() { this.implements(Builtin::error().getType().getUnderlyingType()) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of types with method `name`.
|
||||
*/
|
||||
bindingset[name]
|
||||
int numberOfTypesWithMethodName(string name) { result = count(Type t | t.hasMethod(name, _)) }
|
||||
|
||||
/**
|
||||
* Gets the name of a method in the method set of `i`.
|
||||
*
|
||||
* This is used to restrict the set of interfaces to consider in the definition of `implements`,
|
||||
* so it does not matter which method name is chosen (we use the lexicographically least).
|
||||
* so it does not matter which method name is chosen (we use the most unusual name the interface
|
||||
* requires; this is the most discriminating and so shrinks the search space the most).
|
||||
*/
|
||||
private string getExampleMethodName(InterfaceType i) { result = min(string m | i.hasMethod(m, _)) }
|
||||
private string getExampleMethodName(InterfaceType i) {
|
||||
result = min(string m | i.hasMethod(m, _) | m order by numberOfTypesWithMethodName(m))
|
||||
}
|
||||
|
||||
@@ -501,10 +501,11 @@ module IR {
|
||||
override StructLit lit;
|
||||
|
||||
/** Gets the name of the initialized field. */
|
||||
pragma[nomagic]
|
||||
string getFieldName() {
|
||||
if elt instanceof KeyValueExpr
|
||||
then result = elt.(KeyValueExpr).getKey().(Ident).getName()
|
||||
else lit.getStructType().hasOwnField(i, result, _, _)
|
||||
else pragma[only_bind_out](lit.getStructType()).hasOwnField(i, result, _, _)
|
||||
}
|
||||
|
||||
/** Gets the initialized field. */
|
||||
@@ -1480,7 +1481,7 @@ module IR {
|
||||
|
||||
override predicate refersTo(ValueEntity e) {
|
||||
this instanceof MkLhs and
|
||||
loc = e.getAReference()
|
||||
pragma[only_bind_out](loc) = e.getAReference()
|
||||
or
|
||||
exists(WriteResultInstruction wr | this = MkResultWriteTarget(wr) |
|
||||
e = wr.getResultVariable()
|
||||
|
||||
@@ -8,9 +8,9 @@ private import DataFlowPrivate
|
||||
private predicate isInterfaceCallReceiver(
|
||||
DataFlow::CallNode call, DataFlow::Node recv, InterfaceType tp, string m
|
||||
) {
|
||||
call.getReceiver() = recv and
|
||||
pragma[only_bind_out](call).getReceiver() = recv and
|
||||
recv.getType().getUnderlyingType() = tp and
|
||||
m = call.getACalleeIncludingExternals().asFunction().getName()
|
||||
m = pragma[only_bind_out](call).getACalleeIncludingExternals().asFunction().getName()
|
||||
}
|
||||
|
||||
/** Gets a data-flow node that may flow into the receiver value of `call`, which is an interface value. */
|
||||
|
||||
@@ -525,6 +525,7 @@ module Public {
|
||||
* As `getACalleeIncludingExternals`, except excluding external functions (those for which
|
||||
* we lack a definition, such as standard library functions).
|
||||
*/
|
||||
pragma[nomagic]
|
||||
FuncDef getACallee() { result = this.getACalleeIncludingExternals().getFuncDef() }
|
||||
|
||||
/**
|
||||
|
||||
@@ -284,9 +284,11 @@ signature predicate guardChecksSig(Node g, Expr e, boolean branch);
|
||||
module BarrierGuard<guardChecksSig/3 guardChecks> {
|
||||
/** Gets a node that is safely guarded by the given guard check. */
|
||||
Node getABarrierNode() {
|
||||
exists(ControlFlow::ConditionGuardNode guard, SsaWithFields var | result = var.getAUse() |
|
||||
exists(ControlFlow::ConditionGuardNode guard, SsaWithFields var |
|
||||
result = pragma[only_bind_out](var).getAUse()
|
||||
|
|
||||
guards(_, guard, _, var) and
|
||||
guard.dominates(result.getBasicBlock())
|
||||
pragma[only_bind_out](guard).dominates(result.getBasicBlock())
|
||||
)
|
||||
}
|
||||
|
||||
@@ -339,6 +341,21 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
|
||||
localFlow(pragma[only_bind_out](outp.getNode(c)), resNode)
|
||||
}
|
||||
|
||||
private predicate onlyPossibleReturnSatisfyingProperty(
|
||||
FuncDecl fd, FunctionOutput outp, Node ret, DataFlow::Property p
|
||||
) {
|
||||
exists(boolean b |
|
||||
onlyPossibleReturnOfBool(fd, outp, ret, b) and
|
||||
p.isBoolean(b)
|
||||
)
|
||||
or
|
||||
onlyPossibleReturnOfNonNil(fd, outp, ret) and
|
||||
p.isNonNil()
|
||||
or
|
||||
onlyPossibleReturnOfNil(fd, outp, ret) and
|
||||
p.isNil()
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if whenever `p` holds of output `outp` of function `f`, this node
|
||||
* is known to validate the input `inp` of `f`.
|
||||
@@ -353,24 +370,14 @@ module BarrierGuard<guardChecksSig/3 guardChecks> {
|
||||
) {
|
||||
exists(FuncDecl fd, Node arg, Node ret |
|
||||
fd.getFunction() = f and
|
||||
localFlow(inp.getExitNode(fd), arg) and
|
||||
ret = outp.getEntryNode(fd) and
|
||||
localFlow(inp.getExitNode(fd), pragma[only_bind_out](arg)) and
|
||||
(
|
||||
// Case: a function like "if someBarrierGuard(arg) { return true } else { return false }"
|
||||
exists(ControlFlow::ConditionGuardNode guard |
|
||||
guards(g, guard, arg) and
|
||||
guard.dominates(ret.getBasicBlock())
|
||||
guards(g, pragma[only_bind_out](guard), arg) and
|
||||
guard.dominates(pragma[only_bind_out](ret).getBasicBlock())
|
||||
|
|
||||
exists(boolean b |
|
||||
onlyPossibleReturnOfBool(fd, outp, ret, b) and
|
||||
p.isBoolean(b)
|
||||
)
|
||||
or
|
||||
onlyPossibleReturnOfNonNil(fd, outp, ret) and
|
||||
p.isNonNil()
|
||||
or
|
||||
onlyPossibleReturnOfNil(fd, outp, ret) and
|
||||
p.isNil()
|
||||
onlyPossibleReturnSatisfyingProperty(fd, outp, ret, p)
|
||||
)
|
||||
or
|
||||
// Case: a function like "return someBarrierGuard(arg)"
|
||||
|
||||
@@ -190,6 +190,7 @@ predicate sliceStep(DataFlow::Node pred, DataFlow::Node succ) {
|
||||
*/
|
||||
abstract class FunctionModel extends Function {
|
||||
/** Holds if taint propagates through this function from `input` to `output`. */
|
||||
pragma[nomagic]
|
||||
abstract predicate hasTaintFlow(FunctionInput input, FunctionOutput output);
|
||||
|
||||
/** Gets an input node for this model for the call `c`. */
|
||||
@@ -202,8 +203,8 @@ abstract class FunctionModel extends Function {
|
||||
predicate taintStepForCall(DataFlow::Node pred, DataFlow::Node succ, DataFlow::CallNode c) {
|
||||
c = this.getACall() and
|
||||
exists(FunctionInput inp, FunctionOutput outp | this.hasTaintFlow(inp, outp) |
|
||||
pred = inp.getNode(c) and
|
||||
succ = outp.getNode(c)
|
||||
pred = pragma[only_bind_out](inp).getNode(c) and
|
||||
succ = pragma[only_bind_out](outp).getNode(c)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -382,9 +383,9 @@ predicate inputIsConstantIfOutputHasProperty(
|
||||
) {
|
||||
exists(Function f, FunctionInput inp, FunctionOutput outp, DataFlow::CallNode call |
|
||||
functionEnsuresInputIsConstant(f, inp, outp, p) and
|
||||
call = f.getACall() and
|
||||
inputNode = inp.getNode(call) and
|
||||
DataFlow::localFlow(outp.getNode(call), outputNode)
|
||||
call = pragma[only_bind_out](f).getACall() and
|
||||
inputNode = pragma[only_bind_out](inp).getNode(call) and
|
||||
DataFlow::localFlow(pragma[only_bind_out](outp).getNode(call), outputNode)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ module Afero {
|
||||
exists(Function f |
|
||||
f.hasQualifiedName(aferoPackage(),
|
||||
["WriteReader", "SafeWriteReader", "WriteFile", "ReadFile", "ReadDir"]) and
|
||||
this = f.getACall() and
|
||||
this = pragma[only_bind_out](f.getACall()) and
|
||||
pathArg = 1 and
|
||||
not aferoSanitizer(this.getArgument(0))
|
||||
)
|
||||
@@ -73,7 +73,7 @@ module Afero {
|
||||
exists(Method m |
|
||||
m.hasQualifiedName(aferoPackage(), "Afero",
|
||||
["WriteReader", "SafeWriteReader", "WriteFile", "ReadFile", "ReadDir"]) and
|
||||
this = m.getACall() and
|
||||
this = pragma[only_bind_out](m.getACall()) and
|
||||
pathArg = 0 and
|
||||
not aferoSanitizer(this.getReceiver())
|
||||
)
|
||||
|
||||
@@ -98,6 +98,12 @@ module GoMicro {
|
||||
}
|
||||
}
|
||||
|
||||
bindingset[m]
|
||||
pragma[inline_late]
|
||||
private predicate implementsServiceType(Method m) {
|
||||
m.implements(any(ServiceInterfaceType i).getNamedType().getMethod(_))
|
||||
}
|
||||
|
||||
/**
|
||||
* A service handler.
|
||||
*/
|
||||
@@ -106,7 +112,7 @@ module GoMicro {
|
||||
exists(DataFlow::CallNode call |
|
||||
call.getTarget() instanceof ServiceRegisterHandler and
|
||||
this = call.getArgument(1).getType().getMethod(_) and
|
||||
this.implements(any(ServiceInterfaceType i).getNamedType().getMethod(_))
|
||||
implementsServiceType(this)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,13 +118,19 @@ module Twirp {
|
||||
override string getKind() { result = "URL" }
|
||||
}
|
||||
|
||||
bindingset[m]
|
||||
pragma[inline_late]
|
||||
private predicate implementsServiceType(Method m) {
|
||||
m.implements(any(ServiceInterfaceType i).getNamedType().getMethod(_))
|
||||
}
|
||||
|
||||
/** A service handler. */
|
||||
class ServiceHandler extends Method {
|
||||
ServiceHandler() {
|
||||
exists(DataFlow::CallNode call |
|
||||
call.getTarget() instanceof ServerConstructor and
|
||||
this = call.getArgument(0).getType().getMethod(_) and
|
||||
this.implements(any(ServiceInterfaceType i).getNamedType().getMethod(_))
|
||||
implementsServiceType(this)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,13 @@ module OpenUrlRedirect {
|
||||
}
|
||||
}
|
||||
|
||||
bindingset[var, w]
|
||||
pragma[inline_late]
|
||||
private predicate useIsDominated(SsaWithFields var, Write w, DataFlow::ReadNode sanitizedRead) {
|
||||
w.dominatesNode(sanitizedRead.asInstruction()) and
|
||||
sanitizedRead = var.getAUse()
|
||||
}
|
||||
|
||||
/**
|
||||
* An access to a variable that is preceded by an assignment to its `Path` field.
|
||||
*
|
||||
@@ -83,13 +90,10 @@ module OpenUrlRedirect {
|
||||
*/
|
||||
class PathAssignmentBarrier extends Barrier, Read {
|
||||
PathAssignmentBarrier() {
|
||||
exists(Write w, Field f, SsaWithFields var |
|
||||
f.getName() = "Path" and
|
||||
exists(Write w, SsaWithFields var |
|
||||
hasHostnameSanitizingSubstring(w.getRhs()) and
|
||||
this = var.getAUse()
|
||||
|
|
||||
w.writesField(var.getAUse(), f, _) and
|
||||
w.dominatesNode(insn)
|
||||
w.writesField(var.getAUse(), any(Field f | f.getName() = "Path"), _) and
|
||||
useIsDominated(var, w, this)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,552 @@
|
||||
/** Auto-generated dbscheme; do not edit. Run `make gen` in directory `go/` to regenerate. */
|
||||
|
||||
|
||||
/** Duplicate code **/
|
||||
|
||||
duplicateCode(
|
||||
unique int id : @duplication,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
similarCode(
|
||||
unique int id : @similarity,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
@duplication_or_similarity = @duplication | @similarity;
|
||||
|
||||
tokens(
|
||||
int id : @duplication_or_similarity ref,
|
||||
int offset : int ref,
|
||||
int beginLine : int ref,
|
||||
int beginColumn : int ref,
|
||||
int endLine : int ref,
|
||||
int endColumn : int ref);
|
||||
|
||||
/** External data **/
|
||||
|
||||
externalData(
|
||||
int id : @externalDataElement,
|
||||
varchar(900) path : string ref,
|
||||
int column: int ref,
|
||||
varchar(900) value : string ref
|
||||
);
|
||||
|
||||
snapshotDate(unique date snapshotDate : date ref);
|
||||
|
||||
sourceLocationPrefix(varchar(900) prefix : string ref);
|
||||
|
||||
|
||||
/*
|
||||
* XML Files
|
||||
*/
|
||||
|
||||
xmlEncoding(
|
||||
unique int id: @file ref,
|
||||
string encoding: string ref
|
||||
);
|
||||
|
||||
xmlDTDs(
|
||||
unique int id: @xmldtd,
|
||||
string root: string ref,
|
||||
string publicId: string ref,
|
||||
string systemId: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlElements(
|
||||
unique int id: @xmlelement,
|
||||
string name: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlAttrs(
|
||||
unique int id: @xmlattribute,
|
||||
int elementid: @xmlelement ref,
|
||||
string name: string ref,
|
||||
string value: string ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlNs(
|
||||
int id: @xmlnamespace,
|
||||
string prefixName: string ref,
|
||||
string URI: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlHasNs(
|
||||
int elementId: @xmlnamespaceable ref,
|
||||
int nsId: @xmlnamespace ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlComments(
|
||||
unique int id: @xmlcomment,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlChars(
|
||||
unique int id: @xmlcharacters,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int isCDATA: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
@xmlparent = @file | @xmlelement;
|
||||
@xmlnamespaceable = @xmlelement | @xmlattribute;
|
||||
|
||||
xmllocations(
|
||||
int xmlElement: @xmllocatable ref,
|
||||
int location: @location_default ref
|
||||
);
|
||||
|
||||
@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace;
|
||||
|
||||
compilations(unique int id: @compilation, string cwd: string ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_args(int id: @compilation ref, int num: int ref, string arg: string ref);
|
||||
|
||||
#keyset[id, num, kind]
|
||||
compilation_time(int id: @compilation ref, int num: int ref, int kind: int ref, float secs: float ref);
|
||||
|
||||
diagnostic_for(unique int diagnostic: @diagnostic ref, int compilation: @compilation ref, int file_number: int ref, int file_number_diagnostic_number: int ref);
|
||||
|
||||
compilation_finished(unique int id: @compilation ref, float cpu_seconds: float ref, float elapsed_seconds: float ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_compiling_files(int id: @compilation ref, int num: int ref, int file: @file 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);
|
||||
|
||||
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);
|
||||
|
||||
numlines(int element_id: @sourceline ref, int num_lines: int ref, int num_code: int ref, int num_comment: int ref);
|
||||
|
||||
files(unique int id: @file, string name: string ref);
|
||||
|
||||
folders(unique int id: @folder, string name: string ref);
|
||||
|
||||
containerparent(int parent: @container ref, unique int child: @container ref);
|
||||
|
||||
has_location(unique int locatable: @locatable ref, int location: @location ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
comment_groups(unique int id: @comment_group, int parent: @file ref, int idx: int ref);
|
||||
|
||||
comments(unique int id: @comment, int kind: int ref, int parent: @comment_group ref, int idx: int ref, string text: string ref);
|
||||
|
||||
doc_comments(unique int node: @documentable ref, int comment: @comment_group ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
exprs(unique int id: @expr, int kind: int ref, int parent: @exprparent ref, int idx: int ref);
|
||||
|
||||
literals(unique int expr: @expr ref, string value: string ref, string raw: string ref);
|
||||
|
||||
constvalues(unique int expr: @expr ref, string value: string ref, string exact: string ref);
|
||||
|
||||
fields(unique int id: @field, int parent: @fieldparent ref, int idx: int ref);
|
||||
|
||||
typeparamdecls(unique int id: @typeparamdecl, int parent: @typeparamdeclparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
stmts(unique int id: @stmt, int kind: int ref, int parent: @stmtparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
decls(unique int id: @decl, int kind: int ref, int parent: @declparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
specs(unique int id: @spec, int kind: int ref, int parent: @gendecl ref, int idx: int ref);
|
||||
|
||||
scopes(unique int id: @scope, int kind: int ref);
|
||||
|
||||
scopenesting(unique int inner: @scope ref, int outer: @scope ref);
|
||||
|
||||
scopenodes(unique int node: @scopenode ref, int scope: @localscope ref);
|
||||
|
||||
objects(unique int id: @object, int kind: int ref, string name: string ref);
|
||||
|
||||
objectscopes(unique int object: @object ref, int scope: @scope ref);
|
||||
|
||||
objecttypes(unique int object: @object ref, int tp: @type ref);
|
||||
|
||||
methodreceivers(unique int method: @object ref, int receiver: @object ref);
|
||||
|
||||
fieldstructs(unique int field: @object ref, int struct: @structtype ref);
|
||||
|
||||
methodhosts(int method: @object ref, int host: @namedtype ref);
|
||||
|
||||
defs(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
uses(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
types(unique int id: @type, int kind: int ref);
|
||||
|
||||
type_of(unique int expr: @expr ref, int tp: @type ref);
|
||||
|
||||
typename(unique int tp: @type ref, string name: string ref);
|
||||
|
||||
key_type(unique int map: @maptype ref, int tp: @type ref);
|
||||
|
||||
element_type(unique int container: @containertype ref, int tp: @type ref);
|
||||
|
||||
base_type(unique int ptr: @pointertype ref, int tp: @type ref);
|
||||
|
||||
underlying_type(unique int named: @namedtype ref, int tp: @type ref);
|
||||
|
||||
#keyset[parent, index]
|
||||
component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref);
|
||||
|
||||
#keyset[parent, index]
|
||||
struct_tags(int parent: @structtype ref, int index: int ref, string tag: string ref);
|
||||
|
||||
#keyset[interface, index]
|
||||
interface_private_method_ids(int interface: @interfacetype ref, int index: int ref, string id: string ref);
|
||||
|
||||
array_length(unique int tp: @arraytype ref, string len: string ref);
|
||||
|
||||
type_objects(unique int tp: @type ref, int object: @object ref);
|
||||
|
||||
packages(unique int id: @package, string name: string ref, string path: string ref, int scope: @packagescope ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modexprs(unique int id: @modexpr, int kind: int ref, int parent: @modexprparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modtokens(string token: string ref, int parent: @modexpr ref, int idx: int ref);
|
||||
|
||||
#keyset[package, idx]
|
||||
errors(unique int id: @error, int kind: int ref, string msg: string ref, string rawpos: string ref,
|
||||
string file: string ref, int line: int ref, int col: int ref, int package: @package ref, int idx: int ref);
|
||||
|
||||
has_ellipsis(int id: @callorconversionexpr ref);
|
||||
|
||||
variadic(int id: @signaturetype ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
typeparam(unique int tp: @typeparamtype ref, string name: string ref, int bound: @compositetype ref,
|
||||
int parent: @typeparamparentobject ref, int idx: int ref);
|
||||
|
||||
@container = @file | @folder;
|
||||
|
||||
@locatable = @xmllocatable | @node | @localscope;
|
||||
|
||||
@node = @documentable | @exprparent | @modexprparent | @fieldparent | @stmtparent | @declparent | @typeparamdeclparent
|
||||
| @scopenode | @comment_group | @comment;
|
||||
|
||||
@documentable = @file | @field | @typeparamdecl | @spec | @gendecl | @funcdecl | @modexpr;
|
||||
|
||||
@exprparent = @funcdef | @file | @expr | @field | @stmt | @decl | @typeparamdecl | @spec;
|
||||
|
||||
@modexprparent = @file | @modexpr;
|
||||
|
||||
@fieldparent = @decl | @structtypeexpr | @functypeexpr | @interfacetypeexpr;
|
||||
|
||||
@stmtparent = @funcdef | @stmt | @decl;
|
||||
|
||||
@declparent = @file | @declstmt;
|
||||
|
||||
@typeparamdeclparent = @funcdecl | @typespec;
|
||||
|
||||
@funcdef = @funclit | @funcdecl;
|
||||
|
||||
@scopenode = @file | @functypeexpr | @blockstmt | @ifstmt | @caseclause | @switchstmt | @commclause | @loopstmt;
|
||||
|
||||
@location = @location_default;
|
||||
|
||||
@sourceline = @locatable;
|
||||
|
||||
case @comment.kind of
|
||||
0 = @slashslashcomment
|
||||
| 1 = @slashstarcomment;
|
||||
|
||||
case @expr.kind of
|
||||
0 = @badexpr
|
||||
| 1 = @ident
|
||||
| 2 = @ellipsis
|
||||
| 3 = @intlit
|
||||
| 4 = @floatlit
|
||||
| 5 = @imaglit
|
||||
| 6 = @charlit
|
||||
| 7 = @stringlit
|
||||
| 8 = @funclit
|
||||
| 9 = @compositelit
|
||||
| 10 = @parenexpr
|
||||
| 11 = @selectorexpr
|
||||
| 12 = @indexexpr
|
||||
| 13 = @genericfunctioninstantiationexpr
|
||||
| 14 = @generictypeinstantiationexpr
|
||||
| 15 = @sliceexpr
|
||||
| 16 = @typeassertexpr
|
||||
| 17 = @callorconversionexpr
|
||||
| 18 = @starexpr
|
||||
| 19 = @keyvalueexpr
|
||||
| 20 = @arraytypeexpr
|
||||
| 21 = @structtypeexpr
|
||||
| 22 = @functypeexpr
|
||||
| 23 = @interfacetypeexpr
|
||||
| 24 = @maptypeexpr
|
||||
| 25 = @typesetliteralexpr
|
||||
| 26 = @plusexpr
|
||||
| 27 = @minusexpr
|
||||
| 28 = @notexpr
|
||||
| 29 = @complementexpr
|
||||
| 30 = @derefexpr
|
||||
| 31 = @addressexpr
|
||||
| 32 = @arrowexpr
|
||||
| 33 = @lorexpr
|
||||
| 34 = @landexpr
|
||||
| 35 = @eqlexpr
|
||||
| 36 = @neqexpr
|
||||
| 37 = @lssexpr
|
||||
| 38 = @leqexpr
|
||||
| 39 = @gtrexpr
|
||||
| 40 = @geqexpr
|
||||
| 41 = @addexpr
|
||||
| 42 = @subexpr
|
||||
| 43 = @orexpr
|
||||
| 44 = @xorexpr
|
||||
| 45 = @mulexpr
|
||||
| 46 = @quoexpr
|
||||
| 47 = @remexpr
|
||||
| 48 = @shlexpr
|
||||
| 49 = @shrexpr
|
||||
| 50 = @andexpr
|
||||
| 51 = @andnotexpr
|
||||
| 52 = @sendchantypeexpr
|
||||
| 53 = @recvchantypeexpr
|
||||
| 54 = @sendrcvchantypeexpr;
|
||||
|
||||
@basiclit = @intlit | @floatlit | @imaglit | @charlit | @stringlit;
|
||||
|
||||
@operatorexpr = @logicalexpr | @arithmeticexpr | @bitwiseexpr | @unaryexpr | @binaryexpr;
|
||||
|
||||
@logicalexpr = @logicalunaryexpr | @logicalbinaryexpr;
|
||||
|
||||
@arithmeticexpr = @arithmeticunaryexpr | @arithmeticbinaryexpr;
|
||||
|
||||
@bitwiseexpr = @bitwiseunaryexpr | @bitwisebinaryexpr;
|
||||
|
||||
@unaryexpr = @logicalunaryexpr | @bitwiseunaryexpr | @arithmeticunaryexpr | @derefexpr | @addressexpr | @arrowexpr;
|
||||
|
||||
@logicalunaryexpr = @notexpr;
|
||||
|
||||
@bitwiseunaryexpr = @complementexpr;
|
||||
|
||||
@arithmeticunaryexpr = @plusexpr | @minusexpr;
|
||||
|
||||
@binaryexpr = @logicalbinaryexpr | @bitwisebinaryexpr | @arithmeticbinaryexpr | @comparison;
|
||||
|
||||
@logicalbinaryexpr = @lorexpr | @landexpr;
|
||||
|
||||
@bitwisebinaryexpr = @shiftexpr | @orexpr | @xorexpr | @andexpr | @andnotexpr;
|
||||
|
||||
@arithmeticbinaryexpr = @addexpr | @subexpr | @mulexpr | @quoexpr | @remexpr;
|
||||
|
||||
@shiftexpr = @shlexpr | @shrexpr;
|
||||
|
||||
@comparison = @equalitytest | @relationalcomparison;
|
||||
|
||||
@equalitytest = @eqlexpr | @neqexpr;
|
||||
|
||||
@relationalcomparison = @lssexpr | @leqexpr | @gtrexpr | @geqexpr;
|
||||
|
||||
@chantypeexpr = @sendchantypeexpr | @recvchantypeexpr | @sendrcvchantypeexpr;
|
||||
|
||||
case @stmt.kind of
|
||||
0 = @badstmt
|
||||
| 1 = @declstmt
|
||||
| 2 = @emptystmt
|
||||
| 3 = @labeledstmt
|
||||
| 4 = @exprstmt
|
||||
| 5 = @sendstmt
|
||||
| 6 = @incstmt
|
||||
| 7 = @decstmt
|
||||
| 8 = @gostmt
|
||||
| 9 = @deferstmt
|
||||
| 10 = @returnstmt
|
||||
| 11 = @breakstmt
|
||||
| 12 = @continuestmt
|
||||
| 13 = @gotostmt
|
||||
| 14 = @fallthroughstmt
|
||||
| 15 = @blockstmt
|
||||
| 16 = @ifstmt
|
||||
| 17 = @caseclause
|
||||
| 18 = @exprswitchstmt
|
||||
| 19 = @typeswitchstmt
|
||||
| 20 = @commclause
|
||||
| 21 = @selectstmt
|
||||
| 22 = @forstmt
|
||||
| 23 = @rangestmt
|
||||
| 24 = @assignstmt
|
||||
| 25 = @definestmt
|
||||
| 26 = @addassignstmt
|
||||
| 27 = @subassignstmt
|
||||
| 28 = @mulassignstmt
|
||||
| 29 = @quoassignstmt
|
||||
| 30 = @remassignstmt
|
||||
| 31 = @andassignstmt
|
||||
| 32 = @orassignstmt
|
||||
| 33 = @xorassignstmt
|
||||
| 34 = @shlassignstmt
|
||||
| 35 = @shrassignstmt
|
||||
| 36 = @andnotassignstmt;
|
||||
|
||||
@incdecstmt = @incstmt | @decstmt;
|
||||
|
||||
@assignment = @simpleassignstmt | @compoundassignstmt;
|
||||
|
||||
@simpleassignstmt = @assignstmt | @definestmt;
|
||||
|
||||
@compoundassignstmt = @addassignstmt | @subassignstmt | @mulassignstmt | @quoassignstmt | @remassignstmt
|
||||
| @andassignstmt | @orassignstmt | @xorassignstmt | @shlassignstmt | @shrassignstmt | @andnotassignstmt;
|
||||
|
||||
@branchstmt = @breakstmt | @continuestmt | @gotostmt | @fallthroughstmt;
|
||||
|
||||
@switchstmt = @exprswitchstmt | @typeswitchstmt;
|
||||
|
||||
@loopstmt = @forstmt | @rangestmt;
|
||||
|
||||
case @decl.kind of
|
||||
0 = @baddecl
|
||||
| 1 = @importdecl
|
||||
| 2 = @constdecl
|
||||
| 3 = @typedecl
|
||||
| 4 = @vardecl
|
||||
| 5 = @funcdecl;
|
||||
|
||||
@gendecl = @importdecl | @constdecl | @typedecl | @vardecl;
|
||||
|
||||
case @spec.kind of
|
||||
0 = @importspec
|
||||
| 1 = @valuespec
|
||||
| 2 = @typedefspec
|
||||
| 3 = @aliasspec;
|
||||
|
||||
@typespec = @typedefspec | @aliasspec;
|
||||
|
||||
case @object.kind of
|
||||
0 = @pkgobject
|
||||
| 1 = @decltypeobject
|
||||
| 2 = @builtintypeobject
|
||||
| 3 = @declconstobject
|
||||
| 4 = @builtinconstobject
|
||||
| 5 = @declvarobject
|
||||
| 6 = @declfunctionobject
|
||||
| 7 = @builtinfunctionobject
|
||||
| 8 = @labelobject;
|
||||
|
||||
@typeparamparentobject = @decltypeobject | @declfunctionobject;
|
||||
|
||||
@declobject = @decltypeobject | @declconstobject | @declvarobject | @declfunctionobject;
|
||||
|
||||
@builtinobject = @builtintypeobject | @builtinconstobject | @builtinfunctionobject;
|
||||
|
||||
@typeobject = @decltypeobject | @builtintypeobject;
|
||||
|
||||
@valueobject = @constobject | @varobject | @functionobject;
|
||||
|
||||
@constobject = @declconstobject | @builtinconstobject;
|
||||
|
||||
@varobject = @declvarobject;
|
||||
|
||||
@functionobject = @declfunctionobject | @builtinfunctionobject;
|
||||
|
||||
case @scope.kind of
|
||||
0 = @universescope
|
||||
| 1 = @packagescope
|
||||
| 2 = @localscope;
|
||||
|
||||
case @type.kind of
|
||||
0 = @invalidtype
|
||||
| 1 = @boolexprtype
|
||||
| 2 = @inttype
|
||||
| 3 = @int8type
|
||||
| 4 = @int16type
|
||||
| 5 = @int32type
|
||||
| 6 = @int64type
|
||||
| 7 = @uinttype
|
||||
| 8 = @uint8type
|
||||
| 9 = @uint16type
|
||||
| 10 = @uint32type
|
||||
| 11 = @uint64type
|
||||
| 12 = @uintptrtype
|
||||
| 13 = @float32type
|
||||
| 14 = @float64type
|
||||
| 15 = @complex64type
|
||||
| 16 = @complex128type
|
||||
| 17 = @stringexprtype
|
||||
| 18 = @unsafepointertype
|
||||
| 19 = @boolliteraltype
|
||||
| 20 = @intliteraltype
|
||||
| 21 = @runeliteraltype
|
||||
| 22 = @floatliteraltype
|
||||
| 23 = @complexliteraltype
|
||||
| 24 = @stringliteraltype
|
||||
| 25 = @nilliteraltype
|
||||
| 26 = @typeparamtype
|
||||
| 27 = @arraytype
|
||||
| 28 = @slicetype
|
||||
| 29 = @structtype
|
||||
| 30 = @pointertype
|
||||
| 31 = @interfacetype
|
||||
| 32 = @tupletype
|
||||
| 33 = @signaturetype
|
||||
| 34 = @maptype
|
||||
| 35 = @sendchantype
|
||||
| 36 = @recvchantype
|
||||
| 37 = @sendrcvchantype
|
||||
| 38 = @namedtype
|
||||
| 39 = @typesetliteraltype;
|
||||
|
||||
@basictype = @booltype | @numerictype | @stringtype | @literaltype | @invalidtype | @unsafepointertype;
|
||||
|
||||
@booltype = @boolexprtype | @boolliteraltype;
|
||||
|
||||
@numerictype = @integertype | @floattype | @complextype;
|
||||
|
||||
@integertype = @signedintegertype | @unsignedintegertype;
|
||||
|
||||
@signedintegertype = @inttype | @int8type | @int16type | @int32type | @int64type | @intliteraltype | @runeliteraltype;
|
||||
|
||||
@unsignedintegertype = @uinttype | @uint8type | @uint16type | @uint32type | @uint64type | @uintptrtype;
|
||||
|
||||
@floattype = @float32type | @float64type | @floatliteraltype;
|
||||
|
||||
@complextype = @complex64type | @complex128type | @complexliteraltype;
|
||||
|
||||
@stringtype = @stringexprtype | @stringliteraltype;
|
||||
|
||||
@literaltype = @boolliteraltype | @intliteraltype | @runeliteraltype | @floatliteraltype | @complexliteraltype
|
||||
| @stringliteraltype | @nilliteraltype;
|
||||
|
||||
@compositetype = @typeparamtype | @containertype | @structtype | @pointertype | @interfacetype | @tupletype
|
||||
| @signaturetype | @namedtype | @typesetliteraltype;
|
||||
|
||||
@containertype = @arraytype | @slicetype | @maptype | @chantype;
|
||||
|
||||
@chantype = @sendchantype | @recvchantype | @sendrcvchantype;
|
||||
|
||||
case @modexpr.kind of
|
||||
0 = @modcommentblock
|
||||
| 1 = @modline
|
||||
| 2 = @modlineblock
|
||||
| 3 = @modlparen
|
||||
| 4 = @modrparen;
|
||||
|
||||
case @error.kind of
|
||||
0 = @unknownerror
|
||||
| 1 = @listerror
|
||||
| 2 = @parseerror
|
||||
| 3 = @typeerror;
|
||||
|
||||
@@ -0,0 +1,546 @@
|
||||
/** Auto-generated dbscheme; do not edit. */
|
||||
|
||||
|
||||
/** Duplicate code **/
|
||||
|
||||
duplicateCode(
|
||||
unique int id : @duplication,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
similarCode(
|
||||
unique int id : @similarity,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
@duplication_or_similarity = @duplication | @similarity;
|
||||
|
||||
tokens(
|
||||
int id : @duplication_or_similarity ref,
|
||||
int offset : int ref,
|
||||
int beginLine : int ref,
|
||||
int beginColumn : int ref,
|
||||
int endLine : int ref,
|
||||
int endColumn : int ref);
|
||||
|
||||
/** External data **/
|
||||
|
||||
externalData(
|
||||
int id : @externalDataElement,
|
||||
varchar(900) path : string ref,
|
||||
int column: int ref,
|
||||
varchar(900) value : string ref
|
||||
);
|
||||
|
||||
snapshotDate(unique date snapshotDate : date ref);
|
||||
|
||||
sourceLocationPrefix(varchar(900) prefix : string ref);
|
||||
|
||||
|
||||
/*
|
||||
* XML Files
|
||||
*/
|
||||
|
||||
xmlEncoding(
|
||||
unique int id: @file ref,
|
||||
string encoding: string ref
|
||||
);
|
||||
|
||||
xmlDTDs(
|
||||
unique int id: @xmldtd,
|
||||
string root: string ref,
|
||||
string publicId: string ref,
|
||||
string systemId: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlElements(
|
||||
unique int id: @xmlelement,
|
||||
string name: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlAttrs(
|
||||
unique int id: @xmlattribute,
|
||||
int elementid: @xmlelement ref,
|
||||
string name: string ref,
|
||||
string value: string ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlNs(
|
||||
int id: @xmlnamespace,
|
||||
string prefixName: string ref,
|
||||
string URI: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlHasNs(
|
||||
int elementId: @xmlnamespaceable ref,
|
||||
int nsId: @xmlnamespace ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlComments(
|
||||
unique int id: @xmlcomment,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlChars(
|
||||
unique int id: @xmlcharacters,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int isCDATA: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
@xmlparent = @file | @xmlelement;
|
||||
@xmlnamespaceable = @xmlelement | @xmlattribute;
|
||||
|
||||
xmllocations(
|
||||
int xmlElement: @xmllocatable ref,
|
||||
int location: @location_default ref
|
||||
);
|
||||
|
||||
@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace;
|
||||
|
||||
compilations(unique int id: @compilation, string cwd: string ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_args(int id: @compilation ref, int num: int ref, string arg: string ref);
|
||||
|
||||
#keyset[id, num, kind]
|
||||
compilation_time(int id: @compilation ref, int num: int ref, int kind: int ref, float secs: float ref);
|
||||
|
||||
diagnostic_for(unique int diagnostic: @diagnostic ref, int compilation: @compilation ref, int file_number: int ref, int file_number_diagnostic_number: int ref);
|
||||
|
||||
compilation_finished(unique int id: @compilation ref, float cpu_seconds: float ref, float elapsed_seconds: float ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_compiling_files(int id: @compilation ref, int num: int ref, int file: @file 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);
|
||||
|
||||
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);
|
||||
|
||||
numlines(int element_id: @sourceline ref, int num_lines: int ref, int num_code: int ref, int num_comment: int ref);
|
||||
|
||||
files(unique int id: @file, string name: string ref);
|
||||
|
||||
folders(unique int id: @folder, string name: string ref);
|
||||
|
||||
containerparent(int parent: @container ref, unique int child: @container ref);
|
||||
|
||||
has_location(unique int locatable: @locatable ref, int location: @location ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
comment_groups(unique int id: @comment_group, int parent: @file ref, int idx: int ref);
|
||||
|
||||
comments(unique int id: @comment, int kind: int ref, int parent: @comment_group ref, int idx: int ref, string text: string ref);
|
||||
|
||||
doc_comments(unique int node: @documentable ref, int comment: @comment_group ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
exprs(unique int id: @expr, int kind: int ref, int parent: @exprparent ref, int idx: int ref);
|
||||
|
||||
literals(unique int expr: @expr ref, string value: string ref, string raw: string ref);
|
||||
|
||||
constvalues(unique int expr: @expr ref, string value: string ref, string exact: string ref);
|
||||
|
||||
fields(unique int id: @field, int parent: @fieldparent ref, int idx: int ref);
|
||||
|
||||
typeparamdecls(unique int id: @typeparamdecl, int parent: @typeparamdeclparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
stmts(unique int id: @stmt, int kind: int ref, int parent: @stmtparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
decls(unique int id: @decl, int kind: int ref, int parent: @declparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
specs(unique int id: @spec, int kind: int ref, int parent: @gendecl ref, int idx: int ref);
|
||||
|
||||
scopes(unique int id: @scope, int kind: int ref);
|
||||
|
||||
scopenesting(unique int inner: @scope ref, int outer: @scope ref);
|
||||
|
||||
scopenodes(unique int node: @scopenode ref, int scope: @localscope ref);
|
||||
|
||||
objects(unique int id: @object, int kind: int ref, string name: string ref);
|
||||
|
||||
objectscopes(unique int object: @object ref, int scope: @scope ref);
|
||||
|
||||
objecttypes(unique int object: @object ref, int tp: @type ref);
|
||||
|
||||
methodreceivers(unique int method: @object ref, int receiver: @object ref);
|
||||
|
||||
fieldstructs(unique int field: @object ref, int struct: @structtype ref);
|
||||
|
||||
methodhosts(int method: @object ref, int host: @namedtype ref);
|
||||
|
||||
defs(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
uses(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
types(unique int id: @type, int kind: int ref);
|
||||
|
||||
type_of(unique int expr: @expr ref, int tp: @type ref);
|
||||
|
||||
typename(unique int tp: @type ref, string name: string ref);
|
||||
|
||||
key_type(unique int map: @maptype ref, int tp: @type ref);
|
||||
|
||||
element_type(unique int container: @containertype ref, int tp: @type ref);
|
||||
|
||||
base_type(unique int ptr: @pointertype ref, int tp: @type ref);
|
||||
|
||||
underlying_type(unique int named: @namedtype ref, int tp: @type ref);
|
||||
|
||||
#keyset[parent, index]
|
||||
component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref);
|
||||
|
||||
array_length(unique int tp: @arraytype ref, string len: string ref);
|
||||
|
||||
type_objects(unique int tp: @type ref, int object: @object ref);
|
||||
|
||||
packages(unique int id: @package, string name: string ref, string path: string ref, int scope: @packagescope ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modexprs(unique int id: @modexpr, int kind: int ref, int parent: @modexprparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modtokens(string token: string ref, int parent: @modexpr ref, int idx: int ref);
|
||||
|
||||
#keyset[package, idx]
|
||||
errors(unique int id: @error, int kind: int ref, string msg: string ref, string rawpos: string ref,
|
||||
string file: string ref, int line: int ref, int col: int ref, int package: @package ref, int idx: int ref);
|
||||
|
||||
has_ellipsis(int id: @callorconversionexpr ref);
|
||||
|
||||
variadic(int id: @signaturetype ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
typeparam(unique int tp: @typeparamtype ref, string name: string ref, int bound: @compositetype ref,
|
||||
int parent: @typeparamparentobject ref, int idx: int ref);
|
||||
|
||||
@container = @file | @folder;
|
||||
|
||||
@locatable = @xmllocatable | @node | @localscope;
|
||||
|
||||
@node = @documentable | @exprparent | @modexprparent | @fieldparent | @stmtparent | @declparent | @typeparamdeclparent
|
||||
| @scopenode | @comment_group | @comment;
|
||||
|
||||
@documentable = @file | @field | @typeparamdecl | @spec | @gendecl | @funcdecl | @modexpr;
|
||||
|
||||
@exprparent = @funcdef | @file | @expr | @field | @stmt | @decl | @typeparamdecl | @spec;
|
||||
|
||||
@modexprparent = @file | @modexpr;
|
||||
|
||||
@fieldparent = @decl | @structtypeexpr | @functypeexpr | @interfacetypeexpr;
|
||||
|
||||
@stmtparent = @funcdef | @stmt | @decl;
|
||||
|
||||
@declparent = @file | @declstmt;
|
||||
|
||||
@typeparamdeclparent = @funcdecl | @typespec;
|
||||
|
||||
@funcdef = @funclit | @funcdecl;
|
||||
|
||||
@scopenode = @file | @functypeexpr | @blockstmt | @ifstmt | @caseclause | @switchstmt | @commclause | @loopstmt;
|
||||
|
||||
@location = @location_default;
|
||||
|
||||
@sourceline = @locatable;
|
||||
|
||||
case @comment.kind of
|
||||
0 = @slashslashcomment
|
||||
| 1 = @slashstarcomment;
|
||||
|
||||
case @expr.kind of
|
||||
0 = @badexpr
|
||||
| 1 = @ident
|
||||
| 2 = @ellipsis
|
||||
| 3 = @intlit
|
||||
| 4 = @floatlit
|
||||
| 5 = @imaglit
|
||||
| 6 = @charlit
|
||||
| 7 = @stringlit
|
||||
| 8 = @funclit
|
||||
| 9 = @compositelit
|
||||
| 10 = @parenexpr
|
||||
| 11 = @selectorexpr
|
||||
| 12 = @indexexpr
|
||||
| 13 = @genericfunctioninstantiationexpr
|
||||
| 14 = @generictypeinstantiationexpr
|
||||
| 15 = @sliceexpr
|
||||
| 16 = @typeassertexpr
|
||||
| 17 = @callorconversionexpr
|
||||
| 18 = @starexpr
|
||||
| 19 = @keyvalueexpr
|
||||
| 20 = @arraytypeexpr
|
||||
| 21 = @structtypeexpr
|
||||
| 22 = @functypeexpr
|
||||
| 23 = @interfacetypeexpr
|
||||
| 24 = @maptypeexpr
|
||||
| 25 = @typesetliteralexpr
|
||||
| 26 = @plusexpr
|
||||
| 27 = @minusexpr
|
||||
| 28 = @notexpr
|
||||
| 29 = @complementexpr
|
||||
| 30 = @derefexpr
|
||||
| 31 = @addressexpr
|
||||
| 32 = @arrowexpr
|
||||
| 33 = @lorexpr
|
||||
| 34 = @landexpr
|
||||
| 35 = @eqlexpr
|
||||
| 36 = @neqexpr
|
||||
| 37 = @lssexpr
|
||||
| 38 = @leqexpr
|
||||
| 39 = @gtrexpr
|
||||
| 40 = @geqexpr
|
||||
| 41 = @addexpr
|
||||
| 42 = @subexpr
|
||||
| 43 = @orexpr
|
||||
| 44 = @xorexpr
|
||||
| 45 = @mulexpr
|
||||
| 46 = @quoexpr
|
||||
| 47 = @remexpr
|
||||
| 48 = @shlexpr
|
||||
| 49 = @shrexpr
|
||||
| 50 = @andexpr
|
||||
| 51 = @andnotexpr
|
||||
| 52 = @sendchantypeexpr
|
||||
| 53 = @recvchantypeexpr
|
||||
| 54 = @sendrcvchantypeexpr;
|
||||
|
||||
@basiclit = @intlit | @floatlit | @imaglit | @charlit | @stringlit;
|
||||
|
||||
@operatorexpr = @logicalexpr | @arithmeticexpr | @bitwiseexpr | @unaryexpr | @binaryexpr;
|
||||
|
||||
@logicalexpr = @logicalunaryexpr | @logicalbinaryexpr;
|
||||
|
||||
@arithmeticexpr = @arithmeticunaryexpr | @arithmeticbinaryexpr;
|
||||
|
||||
@bitwiseexpr = @bitwiseunaryexpr | @bitwisebinaryexpr;
|
||||
|
||||
@unaryexpr = @logicalunaryexpr | @bitwiseunaryexpr | @arithmeticunaryexpr | @derefexpr | @addressexpr | @arrowexpr;
|
||||
|
||||
@logicalunaryexpr = @notexpr;
|
||||
|
||||
@bitwiseunaryexpr = @complementexpr;
|
||||
|
||||
@arithmeticunaryexpr = @plusexpr | @minusexpr;
|
||||
|
||||
@binaryexpr = @logicalbinaryexpr | @bitwisebinaryexpr | @arithmeticbinaryexpr | @comparison;
|
||||
|
||||
@logicalbinaryexpr = @lorexpr | @landexpr;
|
||||
|
||||
@bitwisebinaryexpr = @shiftexpr | @orexpr | @xorexpr | @andexpr | @andnotexpr;
|
||||
|
||||
@arithmeticbinaryexpr = @addexpr | @subexpr | @mulexpr | @quoexpr | @remexpr;
|
||||
|
||||
@shiftexpr = @shlexpr | @shrexpr;
|
||||
|
||||
@comparison = @equalitytest | @relationalcomparison;
|
||||
|
||||
@equalitytest = @eqlexpr | @neqexpr;
|
||||
|
||||
@relationalcomparison = @lssexpr | @leqexpr | @gtrexpr | @geqexpr;
|
||||
|
||||
@chantypeexpr = @sendchantypeexpr | @recvchantypeexpr | @sendrcvchantypeexpr;
|
||||
|
||||
case @stmt.kind of
|
||||
0 = @badstmt
|
||||
| 1 = @declstmt
|
||||
| 2 = @emptystmt
|
||||
| 3 = @labeledstmt
|
||||
| 4 = @exprstmt
|
||||
| 5 = @sendstmt
|
||||
| 6 = @incstmt
|
||||
| 7 = @decstmt
|
||||
| 8 = @gostmt
|
||||
| 9 = @deferstmt
|
||||
| 10 = @returnstmt
|
||||
| 11 = @breakstmt
|
||||
| 12 = @continuestmt
|
||||
| 13 = @gotostmt
|
||||
| 14 = @fallthroughstmt
|
||||
| 15 = @blockstmt
|
||||
| 16 = @ifstmt
|
||||
| 17 = @caseclause
|
||||
| 18 = @exprswitchstmt
|
||||
| 19 = @typeswitchstmt
|
||||
| 20 = @commclause
|
||||
| 21 = @selectstmt
|
||||
| 22 = @forstmt
|
||||
| 23 = @rangestmt
|
||||
| 24 = @assignstmt
|
||||
| 25 = @definestmt
|
||||
| 26 = @addassignstmt
|
||||
| 27 = @subassignstmt
|
||||
| 28 = @mulassignstmt
|
||||
| 29 = @quoassignstmt
|
||||
| 30 = @remassignstmt
|
||||
| 31 = @andassignstmt
|
||||
| 32 = @orassignstmt
|
||||
| 33 = @xorassignstmt
|
||||
| 34 = @shlassignstmt
|
||||
| 35 = @shrassignstmt
|
||||
| 36 = @andnotassignstmt;
|
||||
|
||||
@incdecstmt = @incstmt | @decstmt;
|
||||
|
||||
@assignment = @simpleassignstmt | @compoundassignstmt;
|
||||
|
||||
@simpleassignstmt = @assignstmt | @definestmt;
|
||||
|
||||
@compoundassignstmt = @addassignstmt | @subassignstmt | @mulassignstmt | @quoassignstmt | @remassignstmt
|
||||
| @andassignstmt | @orassignstmt | @xorassignstmt | @shlassignstmt | @shrassignstmt | @andnotassignstmt;
|
||||
|
||||
@branchstmt = @breakstmt | @continuestmt | @gotostmt | @fallthroughstmt;
|
||||
|
||||
@switchstmt = @exprswitchstmt | @typeswitchstmt;
|
||||
|
||||
@loopstmt = @forstmt | @rangestmt;
|
||||
|
||||
case @decl.kind of
|
||||
0 = @baddecl
|
||||
| 1 = @importdecl
|
||||
| 2 = @constdecl
|
||||
| 3 = @typedecl
|
||||
| 4 = @vardecl
|
||||
| 5 = @funcdecl;
|
||||
|
||||
@gendecl = @importdecl | @constdecl | @typedecl | @vardecl;
|
||||
|
||||
case @spec.kind of
|
||||
0 = @importspec
|
||||
| 1 = @valuespec
|
||||
| 2 = @typedefspec
|
||||
| 3 = @aliasspec;
|
||||
|
||||
@typespec = @typedefspec | @aliasspec;
|
||||
|
||||
case @object.kind of
|
||||
0 = @pkgobject
|
||||
| 1 = @decltypeobject
|
||||
| 2 = @builtintypeobject
|
||||
| 3 = @declconstobject
|
||||
| 4 = @builtinconstobject
|
||||
| 5 = @declvarobject
|
||||
| 6 = @declfunctionobject
|
||||
| 7 = @builtinfunctionobject
|
||||
| 8 = @labelobject;
|
||||
|
||||
@typeparamparentobject = @decltypeobject | @declfunctionobject;
|
||||
|
||||
@declobject = @decltypeobject | @declconstobject | @declvarobject | @declfunctionobject;
|
||||
|
||||
@builtinobject = @builtintypeobject | @builtinconstobject | @builtinfunctionobject;
|
||||
|
||||
@typeobject = @decltypeobject | @builtintypeobject;
|
||||
|
||||
@valueobject = @constobject | @varobject | @functionobject;
|
||||
|
||||
@constobject = @declconstobject | @builtinconstobject;
|
||||
|
||||
@varobject = @declvarobject;
|
||||
|
||||
@functionobject = @declfunctionobject | @builtinfunctionobject;
|
||||
|
||||
case @scope.kind of
|
||||
0 = @universescope
|
||||
| 1 = @packagescope
|
||||
| 2 = @localscope;
|
||||
|
||||
case @type.kind of
|
||||
0 = @invalidtype
|
||||
| 1 = @boolexprtype
|
||||
| 2 = @inttype
|
||||
| 3 = @int8type
|
||||
| 4 = @int16type
|
||||
| 5 = @int32type
|
||||
| 6 = @int64type
|
||||
| 7 = @uinttype
|
||||
| 8 = @uint8type
|
||||
| 9 = @uint16type
|
||||
| 10 = @uint32type
|
||||
| 11 = @uint64type
|
||||
| 12 = @uintptrtype
|
||||
| 13 = @float32type
|
||||
| 14 = @float64type
|
||||
| 15 = @complex64type
|
||||
| 16 = @complex128type
|
||||
| 17 = @stringexprtype
|
||||
| 18 = @unsafepointertype
|
||||
| 19 = @boolliteraltype
|
||||
| 20 = @intliteraltype
|
||||
| 21 = @runeliteraltype
|
||||
| 22 = @floatliteraltype
|
||||
| 23 = @complexliteraltype
|
||||
| 24 = @stringliteraltype
|
||||
| 25 = @nilliteraltype
|
||||
| 26 = @typeparamtype
|
||||
| 27 = @arraytype
|
||||
| 28 = @slicetype
|
||||
| 29 = @structtype
|
||||
| 30 = @pointertype
|
||||
| 31 = @interfacetype
|
||||
| 32 = @tupletype
|
||||
| 33 = @signaturetype
|
||||
| 34 = @maptype
|
||||
| 35 = @sendchantype
|
||||
| 36 = @recvchantype
|
||||
| 37 = @sendrcvchantype
|
||||
| 38 = @namedtype
|
||||
| 39 = @typesetliteraltype;
|
||||
|
||||
@basictype = @booltype | @numerictype | @stringtype | @literaltype | @invalidtype | @unsafepointertype;
|
||||
|
||||
@booltype = @boolexprtype | @boolliteraltype;
|
||||
|
||||
@numerictype = @integertype | @floattype | @complextype;
|
||||
|
||||
@integertype = @signedintegertype | @unsignedintegertype;
|
||||
|
||||
@signedintegertype = @inttype | @int8type | @int16type | @int32type | @int64type | @intliteraltype | @runeliteraltype;
|
||||
|
||||
@unsignedintegertype = @uinttype | @uint8type | @uint16type | @uint32type | @uint64type | @uintptrtype;
|
||||
|
||||
@floattype = @float32type | @float64type | @floatliteraltype;
|
||||
|
||||
@complextype = @complex64type | @complex128type | @complexliteraltype;
|
||||
|
||||
@stringtype = @stringexprtype | @stringliteraltype;
|
||||
|
||||
@literaltype = @boolliteraltype | @intliteraltype | @runeliteraltype | @floatliteraltype | @complexliteraltype
|
||||
| @stringliteraltype | @nilliteraltype;
|
||||
|
||||
@compositetype = @typeparamtype | @containertype | @structtype | @pointertype | @interfacetype | @tupletype
|
||||
| @signaturetype | @namedtype | @typesetliteraltype;
|
||||
|
||||
@containertype = @arraytype | @slicetype | @maptype | @chantype;
|
||||
|
||||
@chantype = @sendchantype | @recvchantype | @sendrcvchantype;
|
||||
|
||||
case @modexpr.kind of
|
||||
0 = @modcommentblock
|
||||
| 1 = @modline
|
||||
| 2 = @modlineblock
|
||||
| 3 = @modlparen
|
||||
| 4 = @modrparen;
|
||||
|
||||
case @error.kind of
|
||||
0 = @unknownerror
|
||||
| 1 = @listerror
|
||||
| 2 = @parseerror
|
||||
| 3 = @typeerror;
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
description: Add tables for struct tags and interface method IDs
|
||||
compatibility: full
|
||||
@@ -23,8 +23,8 @@ import semmle.go.security.SensitiveActions
|
||||
*/
|
||||
predicate isSensitive(DataFlow::Node sink, SensitiveExpr::Classification type) {
|
||||
exists(Write write, string name |
|
||||
write.getRhs() = sink and
|
||||
name = write.getLhs().getName() and
|
||||
pragma[only_bind_out](write).getRhs() = sink and
|
||||
name = pragma[only_bind_out](write).getLhs().getName() and
|
||||
// allow obvious test password variables
|
||||
not name.regexpMatch(HeuristicNames::notSensitive())
|
||||
|
|
||||
|
||||
@@ -46,3 +46,7 @@
|
||||
| pkg1/tst.go:30:2:30:5 | flag | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 |
|
||||
| pkg2/tst.go:4:2:4:2 | g | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2 |
|
||||
| pkg2/tst.go:8:2:8:2 | g | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2 |
|
||||
| struct_tags.go:4:2:4:7 | field1 | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types |
|
||||
| struct_tags.go:5:2:5:7 | field2 | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types |
|
||||
| struct_tags.go:9:2:9:7 | field1 | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types |
|
||||
| struct_tags.go:10:2:10:7 | field2 | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types |
|
||||
|
||||
@@ -64,3 +64,7 @@
|
||||
| pkg2/tst.go:4:2:4:2 | g | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2.T | g |
|
||||
| pkg2/tst.go:8:2:8:2 | g | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2.G | g |
|
||||
| pkg2/tst.go:8:2:8:2 | g | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2.T | g |
|
||||
| struct_tags.go:4:2:4:7 | field1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.S1 | field1 |
|
||||
| struct_tags.go:5:2:5:7 | field2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.S1 | field2 |
|
||||
| struct_tags.go:9:2:9:7 | field1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.S2 | field1 |
|
||||
| struct_tags.go:10:2:10:7 | field2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.S2 | field2 |
|
||||
|
||||
@@ -64,3 +64,7 @@
|
||||
| pkg2/tst.go:4:2:4:2 | g | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2 | T | g |
|
||||
| pkg2/tst.go:8:2:8:2 | g | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2 | G | g |
|
||||
| pkg2/tst.go:8:2:8:2 | g | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2 | T | g |
|
||||
| struct_tags.go:4:2:4:7 | field1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types | S1 | field1 |
|
||||
| struct_tags.go:5:2:5:7 | field2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types | S1 | field2 |
|
||||
| struct_tags.go:9:2:9:7 | field1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types | S2 | field1 |
|
||||
| struct_tags.go:10:2:10:7 | field2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types | S2 | field2 |
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
| interface { Exported func() ; notExported func() } | func() | Exported |
|
||||
| interface { Exported func() ; notExported func() } | func() | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.notExported |
|
||||
| interface { Exported func() ; notExported func() } | func() | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2.notExported |
|
||||
@@ -0,0 +1,12 @@
|
||||
import go
|
||||
|
||||
from NamedType nt, InterfaceType it, Type methodType, string id
|
||||
where
|
||||
nt.getName() = "MixedExportedAndNot" and
|
||||
it = nt.getUnderlyingType() and
|
||||
(
|
||||
it.hasPrivateMethodWithQualifiedName(_, id, methodType)
|
||||
or
|
||||
it.hasMethod(id, methodType) and not it.hasPrivateMethodWithQualifiedName(id, _, _)
|
||||
)
|
||||
select it.pp(), methodType.pp(), id
|
||||
@@ -14,6 +14,7 @@
|
||||
| C | 2 |
|
||||
| Foo | 1 |
|
||||
| GenericInterface | 1 |
|
||||
| MixedExportedAndNot | 2 |
|
||||
| MyInterface | 17 |
|
||||
| T | 1 |
|
||||
| T3 | 1 |
|
||||
|
||||
@@ -48,6 +48,10 @@
|
||||
| pkg1/interfaces.go:26:6:26:14 | AExtended | m | func() |
|
||||
| pkg1/interfaces.go:26:6:26:14 | AExtended | n | func() |
|
||||
| pkg1/interfaces.go:31:6:31:7 | A2 | m | func() |
|
||||
| pkg1/interfaces.go:35:6:35:24 | MixedExportedAndNot | Exported | func() |
|
||||
| pkg1/interfaces.go:35:6:35:24 | MixedExportedAndNot | notExported | func() |
|
||||
| pkg1/tst.go:3:6:3:6 | T | half | func() Foo |
|
||||
| pkg1/tst.go:14:6:14:7 | T3 | half | func() Foo |
|
||||
| pkg1/tst.go:19:6:19:7 | T4 | half | func() Foo |
|
||||
| pkg2/tst.go:11:6:11:24 | MixedExportedAndNot | Exported | func() |
|
||||
| pkg2/tst.go:11:6:11:24 | MixedExportedAndNot | notExported | func() |
|
||||
|
||||
@@ -53,7 +53,11 @@
|
||||
| pkg1/interfaces.go:14:2:14:2 | o | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.C | o |
|
||||
| pkg1/interfaces.go:28:2:28:2 | n | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.AExtended | n |
|
||||
| pkg1/interfaces.go:32:2:32:2 | m | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.A2 | m |
|
||||
| pkg1/interfaces.go:36:2:36:9 | Exported | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.MixedExportedAndNot | Exported |
|
||||
| pkg1/interfaces.go:37:2:37:12 | notExported | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.MixedExportedAndNot | notExported |
|
||||
| pkg1/tst.go:33:16:33:19 | half | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.Foo | half |
|
||||
| pkg1/tst.go:33:16:33:19 | half | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T | half |
|
||||
| pkg1/tst.go:33:16:33:19 | half | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T3 | half |
|
||||
| pkg1/tst.go:33:16:33:19 | half | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T4 | half |
|
||||
| pkg2/tst.go:12:2:12:9 | Exported | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2.MixedExportedAndNot | Exported |
|
||||
| pkg2/tst.go:13:2:13:12 | notExported | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2.MixedExportedAndNot | notExported |
|
||||
|
||||
@@ -53,7 +53,11 @@
|
||||
| pkg1/interfaces.go:14:2:14:2 | o | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | C | o |
|
||||
| pkg1/interfaces.go:28:2:28:2 | n | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | AExtended | n |
|
||||
| pkg1/interfaces.go:32:2:32:2 | m | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | A2 | m |
|
||||
| pkg1/interfaces.go:36:2:36:9 | Exported | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | MixedExportedAndNot | Exported |
|
||||
| pkg1/interfaces.go:37:2:37:12 | notExported | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | MixedExportedAndNot | notExported |
|
||||
| pkg1/tst.go:33:16:33:19 | half | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | Foo | half |
|
||||
| pkg1/tst.go:33:16:33:19 | half | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | T | half |
|
||||
| pkg1/tst.go:33:16:33:19 | half | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | T3 | half |
|
||||
| pkg1/tst.go:33:16:33:19 | half | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1 | T4 | half |
|
||||
| pkg2/tst.go:12:2:12:9 | Exported | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2 | MixedExportedAndNot | Exported |
|
||||
| pkg2/tst.go:13:2:13:12 | notExported | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2 | MixedExportedAndNot | notExported |
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
| C | o | pkg1/interfaces.go:14:2:14:2 | o |
|
||||
| Foo | half | pkg1/tst.go:33:16:33:19 | half |
|
||||
| GenericInterface | GetT | generic.go:33:2:33:5 | GetT |
|
||||
| MixedExportedAndNot | Exported | pkg1/interfaces.go:36:2:36:9 | Exported |
|
||||
| MixedExportedAndNot | Exported | pkg2/tst.go:12:2:12:9 | Exported |
|
||||
| MixedExportedAndNot | notExported | pkg1/interfaces.go:37:2:37:12 | notExported |
|
||||
| MixedExportedAndNot | notExported | pkg2/tst.go:13:2:13:12 | notExported |
|
||||
| MyInterface | clone | generic.go:48:2:48:6 | clone |
|
||||
| MyInterface | dummy1 | generic.go:49:2:49:7 | dummy1 |
|
||||
| MyInterface | dummy2 | generic.go:50:2:50:7 | dummy2 |
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
| pkg1/interfaces.go:21:6:21:7 | AC | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.AC |
|
||||
| pkg1/interfaces.go:26:6:26:14 | AExtended | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.AExtended |
|
||||
| pkg1/interfaces.go:31:6:31:7 | A2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.A2 |
|
||||
| pkg1/interfaces.go:35:6:35:24 | MixedExportedAndNot | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.MixedExportedAndNot |
|
||||
| pkg1/tst.go:3:6:3:6 | T | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T |
|
||||
| pkg1/tst.go:9:6:9:7 | T2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T2 |
|
||||
| pkg1/tst.go:14:6:14:7 | T3 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.T3 |
|
||||
@@ -98,3 +99,6 @@
|
||||
| pkg1/tst.go:29:6:29:8 | Bar | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg1.Bar |
|
||||
| pkg2/tst.go:3:6:3:6 | T | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2.T |
|
||||
| pkg2/tst.go:7:6:7:6 | G | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2.G |
|
||||
| pkg2/tst.go:11:6:11:24 | MixedExportedAndNot | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types/pkg2.MixedExportedAndNot |
|
||||
| struct_tags.go:3:6:3:7 | S1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.S1 |
|
||||
| struct_tags.go:8:6:8:7 | S2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.S2 |
|
||||
|
||||
@@ -66,3 +66,7 @@
|
||||
| pkg2/tst.go:3:6:3:6 | T | pkg2/tst.go:7:8:9:1 | struct type | g | int |
|
||||
| pkg2/tst.go:7:6:7:6 | G | pkg2/tst.go:3:8:5:1 | struct type | g | int |
|
||||
| pkg2/tst.go:7:6:7:6 | G | pkg2/tst.go:7:8:9:1 | struct type | g | int |
|
||||
| struct_tags.go:3:6:3:7 | S1 | struct_tags.go:3:9:6:1 | struct type | field1 | int |
|
||||
| struct_tags.go:3:6:3:7 | S1 | struct_tags.go:3:9:6:1 | struct type | field2 | int |
|
||||
| struct_tags.go:8:6:8:7 | S2 | struct_tags.go:8:9:11:1 | struct type | field1 | int |
|
||||
| struct_tags.go:8:6:8:7 | S2 | struct_tags.go:8:9:11:1 | struct type | field2 | int |
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
| pkg1/interfaces.go:21:6:21:7 | AC | AC |
|
||||
| pkg1/interfaces.go:26:6:26:14 | AExtended | AExtended |
|
||||
| pkg1/interfaces.go:31:6:31:7 | A2 | A2 |
|
||||
| pkg1/interfaces.go:35:6:35:24 | MixedExportedAndNot | MixedExportedAndNot |
|
||||
| pkg1/tst.go:3:6:3:6 | T | T |
|
||||
| pkg1/tst.go:9:6:9:7 | T2 | T2 |
|
||||
| pkg1/tst.go:14:6:14:7 | T3 | T3 |
|
||||
@@ -98,3 +99,6 @@
|
||||
| pkg1/tst.go:29:6:29:8 | Bar | Bar |
|
||||
| pkg2/tst.go:3:6:3:6 | T | T |
|
||||
| pkg2/tst.go:7:6:7:6 | G | G |
|
||||
| pkg2/tst.go:11:6:11:24 | MixedExportedAndNot | MixedExportedAndNot |
|
||||
| struct_tags.go:3:6:3:7 | S1 | S1 |
|
||||
| struct_tags.go:8:6:8:7 | S2 | S2 |
|
||||
|
||||
@@ -31,3 +31,8 @@ type AExtended interface {
|
||||
type A2 interface {
|
||||
m()
|
||||
}
|
||||
|
||||
type MixedExportedAndNot interface {
|
||||
Exported()
|
||||
notExported()
|
||||
}
|
||||
|
||||
@@ -7,3 +7,8 @@ type T struct {
|
||||
type G struct {
|
||||
g int
|
||||
}
|
||||
|
||||
type MixedExportedAndNot interface {
|
||||
Exported()
|
||||
notExported()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
| struct { field1 int `tag1a`; field2 int `tag2a` } | struct_tags.go:4:2:4:7 | field1 | tag1a |
|
||||
| struct { field1 int `tag1a`; field2 int `tag2a` } | struct_tags.go:5:2:5:7 | field2 | tag2a |
|
||||
| struct { field1 int `tag1b`; field2 int `tag2b` } | struct_tags.go:9:2:9:7 | field1 | tag1b |
|
||||
| struct { field1 int `tag1b`; field2 int `tag2b` } | struct_tags.go:10:2:10:7 | field2 | tag2b |
|
||||
11
go/ql/test/library-tests/semmle/go/Types/struct_tags.go
Normal file
11
go/ql/test/library-tests/semmle/go/Types/struct_tags.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package main
|
||||
|
||||
type S1 struct {
|
||||
field1 int `tag1a`
|
||||
field2 int `tag2a`
|
||||
}
|
||||
|
||||
type S2 struct {
|
||||
field1 int `tag1b`
|
||||
field2 int `tag2b`
|
||||
}
|
||||
8
go/ql/test/library-tests/semmle/go/Types/struct_tags.ql
Normal file
8
go/ql/test/library-tests/semmle/go/Types/struct_tags.ql
Normal file
@@ -0,0 +1,8 @@
|
||||
import go
|
||||
|
||||
from StructType s, Field f, string tag
|
||||
where
|
||||
f = s.getOwnField(_, _) and
|
||||
tag = f.getTag() and
|
||||
tag != ""
|
||||
select s.pp(), f, tag
|
||||
Reference in New Issue
Block a user