Skip to content

Commit 036d749

Browse files
authored
Merge pull request #126 from github/erik-krogh/update-sources
update sources
2 parents 349b556 + a0bf130 commit 036d749

File tree

936 files changed

+28234
-15079
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

936 files changed

+28234
-15079
lines changed

repo-tests/codeql-go.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
abe3f2148b92b1a94a0a3676cb4dab7d9211076f
1+
4cae4b23fc1b2b1760e259b660996e9bb5573279

repo-tests/codeql-go/ql/lib/go.dbscheme

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ errors(unique int id: @error, int kind: int ref, string msg: string ref, string
223223

224224
has_ellipsis(int id: @callorconversionexpr ref);
225225

226+
variadic(int id: @signaturetype ref);
227+
226228
@container = @file | @folder;
227229

228230
@locatable = @xmllocatable | @node | @localscope;

repo-tests/codeql-go/ql/lib/semmle/go/Comments.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ class CommentGroup extends @comment_group, AstNode {
6060
Comment getComment(int i) { comments(result, _, this, i, _) }
6161

6262
/** Gets a comment in this group. */
63-
Comment getAComment() { result = getComment(_) }
63+
Comment getAComment() { result = this.getComment(_) }
6464

6565
/** Gets the number of comments in this group. */
66-
int getNumComment() { result = count(getAComment()) }
66+
int getNumComment() { result = count(this.getAComment()) }
6767

6868
override string toString() { result = "comment group" }
6969

@@ -219,8 +219,8 @@ class BuildConstraintComment extends LineComment {
219219
override string getAPrimaryQlClass() { result = "BuildConstraintComment" }
220220

221221
/** Gets the body of this build constraint. */
222-
string getConstraintBody() { result = getText().splitAt("build ", 1) }
222+
string getConstraintBody() { result = this.getText().splitAt("build ", 1) }
223223

224224
/** Gets a disjunct of this build constraint. */
225-
string getADisjunct() { result = getConstraintBody().splitAt(" ") }
225+
string getADisjunct() { result = this.getConstraintBody().splitAt(" ") }
226226
}

repo-tests/codeql-go/ql/lib/semmle/go/Decls.qll

Lines changed: 45 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ class GenDecl extends @gendecl, Decl, Documentable {
4242
Spec getSpec(int i) { specs(result, _, this, i) }
4343

4444
/** Gets a declaration specifier in this declaration. */
45-
Spec getASpec() { result = getSpec(_) }
45+
Spec getASpec() { result = this.getSpec(_) }
4646

4747
/** Gets the number of declaration specifiers in this declaration. */
48-
int getNumSpec() { result = count(getASpec()) }
48+
int getNumSpec() { result = count(this.getASpec()) }
4949

50-
override predicate mayHaveSideEffects() { getASpec().mayHaveSideEffects() }
50+
override predicate mayHaveSideEffects() { this.getASpec().mayHaveSideEffects() }
5151

5252
override string getAPrimaryQlClass() { result = "GenDecl" }
5353
}
@@ -130,13 +130,15 @@ class FuncDef extends @funcdef, StmtParent, ExprParent {
130130
/**
131131
* Gets the number of parameters of this function.
132132
*/
133-
int getNumParameter() { result = count(getAParameter()) }
133+
int getNumParameter() { result = count(this.getAParameter()) }
134134

135135
/**
136136
* Gets a call to this function.
137137
*/
138138
DataFlow::CallNode getACall() { result.getACallee() = this }
139139

140+
predicate isVariadic() { getType().isVariadic() }
141+
140142
override string getAPrimaryQlClass() { result = "FuncDef" }
141143
}
142144

@@ -145,16 +147,16 @@ class FuncDef extends @funcdef, StmtParent, ExprParent {
145147
*/
146148
class FuncDecl extends @funcdecl, Decl, Documentable, FuncDef {
147149
/** Gets the identifier denoting the name of this function. */
148-
Ident getNameExpr() { result = getChildExpr(0) }
150+
Ident getNameExpr() { result = this.getChildExpr(0) }
149151

150-
override string getName() { result = getNameExpr().getName() }
152+
override string getName() { result = this.getNameExpr().getName() }
151153

152-
override FuncTypeExpr getTypeExpr() { result = getChildExpr(1) }
154+
override FuncTypeExpr getTypeExpr() { result = this.getChildExpr(1) }
153155

154-
override SignatureType getType() { result = getNameExpr().getType() }
156+
override SignatureType getType() { result = this.getNameExpr().getType() }
155157

156158
/** Gets the body of this function, if any. */
157-
override BlockStmt getBody() { result = getChildStmt(2) }
159+
override BlockStmt getBody() { result = this.getChildStmt(2) }
158160

159161
/** Gets the function declared by this function declaration. */
160162
DeclaredFunction getFunction() { this = result.getFuncDecl() }
@@ -196,7 +198,7 @@ class MethodDecl extends FuncDecl {
196198
*
197199
* is `*Rectangle`.
198200
*/
199-
Type getReceiverType() { result = getReceiverDecl().getType() }
201+
Type getReceiverType() { result = this.getReceiverDecl().getType() }
200202

201203
/**
202204
* Gets the receiver base type of this method.
@@ -210,8 +212,8 @@ class MethodDecl extends FuncDecl {
210212
* is `Rectangle`.
211213
*/
212214
NamedType getReceiverBaseType() {
213-
result = getReceiverType() or
214-
result = getReceiverType().(PointerType).getBaseType()
215+
result = this.getReceiverType() or
216+
result = this.getReceiverType().(PointerType).getBaseType()
215217
}
216218

217219
/**
@@ -261,16 +263,16 @@ class Spec extends @spec, ExprParent, Documentable {
261263
*/
262264
class ImportSpec extends @importspec, Spec {
263265
/** Gets the identifier denoting the imported name. */
264-
Ident getNameExpr() { result = getChildExpr(0) }
266+
Ident getNameExpr() { result = this.getChildExpr(0) }
265267

266268
/** Gets the imported name. */
267-
string getName() { result = getNameExpr().getName() }
269+
string getName() { result = this.getNameExpr().getName() }
268270

269271
/** Gets the string literal denoting the imported path. */
270-
StringLit getPathExpr() { result = getChildExpr(1) }
272+
StringLit getPathExpr() { result = this.getChildExpr(1) }
271273

272274
/** Gets the imported path. */
273-
string getPath() { result = getPathExpr().getValue() }
275+
string getPath() { result = this.getPathExpr().getValue() }
274276

275277
override string toString() { result = "import specifier" }
276278

@@ -284,41 +286,41 @@ class ValueSpec extends @valuespec, Spec {
284286
/** Gets the identifier denoting the `i`th name declared by this specifier (0-based). */
285287
Ident getNameExpr(int i) {
286288
i >= 0 and
287-
result = getChildExpr(-(i + 1))
289+
result = this.getChildExpr(-(i + 1))
288290
}
289291

290292
/** Holds if this specifier is a part of a constant declaration. */
291293
predicate isConstSpec() { this.getParentDecl() instanceof ConstDecl }
292294

293295
/** Gets an identifier denoting a name declared by this specifier. */
294-
Ident getANameExpr() { result = getNameExpr(_) }
296+
Ident getANameExpr() { result = this.getNameExpr(_) }
295297

296298
/** Gets the `i`th name declared by this specifier (0-based). */
297-
string getName(int i) { result = getNameExpr(i).getName() }
299+
string getName(int i) { result = this.getNameExpr(i).getName() }
298300

299301
/** Gets a name declared by this specifier. */
300-
string getAName() { result = getName(_) }
302+
string getAName() { result = this.getName(_) }
301303

302304
/** Gets the number of names declared by this specifier. */
303-
int getNumName() { result = count(getANameExpr()) }
305+
int getNumName() { result = count(this.getANameExpr()) }
304306

305307
/** Gets the expression denoting the type of the symbols declared by this specifier. */
306-
Expr getTypeExpr() { result = getChildExpr(0) }
308+
Expr getTypeExpr() { result = this.getChildExpr(0) }
307309

308310
/** Gets the `i`th initializer of this specifier (0-based). */
309311
Expr getInit(int i) {
310312
i >= 0 and
311-
result = getChildExpr(i + 1)
313+
result = this.getChildExpr(i + 1)
312314
}
313315

314316
/** Gets an initializer of this specifier. */
315-
Expr getAnInit() { result = getInit(_) }
317+
Expr getAnInit() { result = this.getInit(_) }
316318

317319
/** Gets the number of initializers of this specifier. */
318-
int getNumInit() { result = count(getAnInit()) }
320+
int getNumInit() { result = count(this.getAnInit()) }
319321

320322
/** Gets the unique initializer of this specifier, if there is only one. */
321-
Expr getInit() { getNumInit() = 1 and result = getInit(0) }
323+
Expr getInit() { this.getNumInit() = 1 and result = this.getInit(0) }
322324

323325
/**
324326
* Gets the specifier that contains the initializers for this specifier.
@@ -349,12 +351,12 @@ class ValueSpec extends @valuespec, Spec {
349351
/** Holds if this specifier initializes `name` to the value of `init`. */
350352
predicate initializes(string name, Expr init) {
351353
exists(int i |
352-
name = getName(i) and
353-
init = getEffectiveInit(i)
354+
name = this.getName(i) and
355+
init = this.getEffectiveInit(i)
354356
)
355357
}
356358

357-
override predicate mayHaveSideEffects() { getAnInit().mayHaveSideEffects() }
359+
override predicate mayHaveSideEffects() { this.getAnInit().mayHaveSideEffects() }
358360

359361
override string toString() { result = "value declaration specifier" }
360362

@@ -375,15 +377,15 @@ class ValueSpec extends @valuespec, Spec {
375377
*/
376378
class TypeSpec extends @typespec, Spec {
377379
/** Gets the identifier denoting the name of the declared type. */
378-
Ident getNameExpr() { result = getChildExpr(0) }
380+
Ident getNameExpr() { result = this.getChildExpr(0) }
379381

380382
/** Gets the name of the declared type. */
381-
string getName() { result = getNameExpr().getName() }
383+
string getName() { result = this.getNameExpr().getName() }
382384

383385
/**
384386
* Gets the expression denoting the underlying type to which the newly declared type is bound.
385387
*/
386-
Expr getTypeExpr() { result = getChildExpr(1) }
388+
Expr getTypeExpr() { result = this.getChildExpr(1) }
387389

388390
override string toString() { result = "type declaration specifier" }
389391

@@ -420,12 +422,12 @@ class FieldBase extends @field, ExprParent {
420422
/**
421423
* Gets the expression representing the type of the fields declared in this declaration.
422424
*/
423-
Expr getTypeExpr() { result = getChildExpr(0) }
425+
Expr getTypeExpr() { result = this.getChildExpr(0) }
424426

425427
/**
426428
* Gets the type of the fields declared in this declaration.
427429
*/
428-
Type getType() { result = getTypeExpr().getType() }
430+
Type getType() { result = this.getTypeExpr().getType() }
429431
}
430432

431433
/**
@@ -442,17 +444,17 @@ class FieldDecl extends FieldBase, Documentable, ExprParent {
442444
*/
443445
Expr getNameExpr(int i) {
444446
i >= 0 and
445-
result = getChildExpr(i + 1)
447+
result = this.getChildExpr(i + 1)
446448
}
447449

448450
/** Gets the tag expression of this field declaration, if any. */
449-
Expr getTag() { result = getChildExpr(-1) }
451+
Expr getTag() { result = this.getChildExpr(-1) }
450452

451453
/** Gets the struct type expression to which this field declaration belongs. */
452454
StructTypeExpr getDeclaringStructTypeExpr() { result = st }
453455

454456
/** Gets the struct type to which this field declaration belongs. */
455-
StructType getDeclaringType() { result = getDeclaringStructTypeExpr().getType() }
457+
StructType getDeclaringType() { result = this.getDeclaringStructTypeExpr().getType() }
456458

457459
override string toString() { result = "field declaration" }
458460

@@ -485,21 +487,21 @@ class ParameterOrResultDecl extends FieldBase, Documentable, ExprParent {
485487
/**
486488
* Gets the function to which this declaration belongs.
487489
*/
488-
FuncDef getFunction() { result.getTypeExpr() = getFunctionTypeExpr() }
490+
FuncDef getFunction() { result.getTypeExpr() = this.getFunctionTypeExpr() }
489491

490492
/**
491493
* Gets the expression representing the name of the `i`th variable declared in this declaration
492494
* (0-based).
493495
*/
494496
Expr getNameExpr(int i) {
495497
i >= 0 and
496-
result = getChildExpr(i + 1)
498+
result = this.getChildExpr(i + 1)
497499
}
498500

499501
/**
500502
* Gets an expression representing the name of a variable declared in this declaration.
501503
*/
502-
Expr getANameExpr() { result = getNameExpr(_) }
504+
Expr getANameExpr() { result = this.getNameExpr(_) }
503505
}
504506

505507
/**
@@ -535,7 +537,7 @@ class ReceiverDecl extends FieldBase, Documentable, ExprParent {
535537
/**
536538
* Gets the expression representing the name of the receiver declared in this declaration.
537539
*/
538-
Expr getNameExpr() { result = getChildExpr(1) }
540+
Expr getNameExpr() { result = this.getChildExpr(1) }
539541

540542
override string toString() { result = "receiver declaration" }
541543

@@ -586,7 +588,7 @@ class InterfaceMemberSpec extends FieldBase, Documentable, ExprParent {
586588
class MethodSpec extends InterfaceMemberSpec {
587589
Expr name;
588590

589-
MethodSpec() { name = getChildExpr(1) }
591+
MethodSpec() { name = this.getChildExpr(1) }
590592

591593
/**
592594
* Gets the expression representing the name of the method declared in this specification.
@@ -602,7 +604,7 @@ class MethodSpec extends InterfaceMemberSpec {
602604
* An embedding specification in an interface.
603605
*/
604606
class EmbeddingSpec extends InterfaceMemberSpec {
605-
EmbeddingSpec() { not exists(getChildExpr(1)) }
607+
EmbeddingSpec() { not exists(this.getChildExpr(1)) }
606608

607609
override string toString() { result = "interface embedding" }
608610

0 commit comments

Comments
 (0)