Skip to content

Commit f712177

Browse files
committed
Merge branch 'main' into aeisenberg/getting-started-docs
2 parents aee9eb5 + 497c878 commit f712177

File tree

434 files changed

+25267
-5981
lines changed

Some content is hidden

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

434 files changed

+25267
-5981
lines changed

config/identical-files.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl5.qll",
88
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl6.qll",
99
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplForSerializability.qll",
10+
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplForOnActivityResult.qll",
1011
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll",
1112
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll",
1213
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll",

cpp/ql/lib/semmle/code/cpp/Class.qll

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,7 @@ class Class extends UserType {
206206
* it is callable by a particular caller. For C++11, there's also a question
207207
* of whether to include members that are defaulted or deleted.
208208
*/
209-
deprecated predicate hasCopyConstructor() {
210-
exists(CopyConstructor cc | cc = this.getAMemberFunction())
211-
}
209+
deprecated predicate hasCopyConstructor() { this.getAMemberFunction() instanceof CopyConstructor }
212210

213211
/**
214212
* Holds if this class has a copy assignment operator that is either
@@ -224,7 +222,7 @@ class Class extends UserType {
224222
* or deleted.
225223
*/
226224
deprecated predicate hasCopyAssignmentOperator() {
227-
exists(CopyAssignmentOperator coa | coa = this.getAMemberFunction())
225+
this.getAMemberFunction() instanceof CopyAssignmentOperator
228226
}
229227

230228
/**
@@ -887,7 +885,7 @@ class NestedClass extends Class {
887885
* pure virtual function.
888886
*/
889887
class AbstractClass extends Class {
890-
AbstractClass() { exists(PureVirtualFunction f | this.getAMemberFunction() = f) }
888+
AbstractClass() { this.getAMemberFunction() instanceof PureVirtualFunction }
891889

892890
override string getAPrimaryQlClass() { result = "AbstractClass" }
893891
}

cpp/ql/lib/semmle/code/cpp/Specifier.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,13 @@ class AttributeArgument extends Element, @attribute_arg {
286286
override Location getLocation() { attribute_args(underlyingElement(this), _, _, _, result) }
287287

288288
override string toString() {
289-
if exists(@attribute_arg_empty self | self = underlyingElement(this))
289+
if underlyingElement(this) instanceof @attribute_arg_empty
290290
then result = "empty argument"
291291
else
292292
exists(string prefix, string tail |
293293
(if exists(this.getName()) then prefix = this.getName() + "=" else prefix = "") and
294294
(
295-
if exists(@attribute_arg_type self | self = underlyingElement(this))
295+
if underlyingElement(this) instanceof @attribute_arg_type
296296
then tail = this.getValueType().getName()
297297
else tail = this.getValueText()
298298
) and

cpp/ql/lib/semmle/code/cpp/XML.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable {
233233
XMLAttribute getAttribute(string name) { result.getElement() = this and result.getName() = name }
234234

235235
/** Holds if this XML element has an attribute with the specified `name`. */
236-
predicate hasAttribute(string name) { exists(XMLAttribute a | a = this.getAttribute(name)) }
236+
predicate hasAttribute(string name) { exists(this.getAttribute(name)) }
237237

238238
/** Gets the value of the attribute with the specified `name`, if any. */
239239
string getAttributeValue(string name) { result = this.getAttribute(name).getValue() }

cpp/ql/lib/semmle/code/cpp/commons/Printf.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ class FormatLiteral extends Literal {
11221122
* conversion specifier of this format string; has no result if this cannot
11231123
* be determined.
11241124
*/
1125-
int getMaxConvertedLength(int n) { result = max(getMaxConvertedLength(n, _)) }
1125+
int getMaxConvertedLength(int n) { result = max(this.getMaxConvertedLength(n, _)) }
11261126

11271127
/**
11281128
* Gets the maximum length of the string that can be produced by the nth
@@ -1353,7 +1353,7 @@ class FormatLiteral extends Literal {
13531353
* determining whether a buffer overflow is caused by long float to string
13541354
* conversions.
13551355
*/
1356-
int getMaxConvertedLengthLimited(int n) { result = max(getMaxConvertedLengthLimited(n, _)) }
1356+
int getMaxConvertedLengthLimited(int n) { result = max(this.getMaxConvertedLengthLimited(n, _)) }
13571357

13581358
/**
13591359
* Gets the maximum length of the string that can be produced by the nth

cpp/ql/lib/semmle/code/cpp/controlflow/IRGuards.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class GuardCondition extends Expr {
2929
exists(IRGuardCondition ir | this = ir.getUnconvertedResultExpression())
3030
or
3131
// no binary operators in the IR
32-
exists(GuardCondition gc | this.(BinaryLogicalOperation).getAnOperand() = gc)
32+
this.(BinaryLogicalOperation).getAnOperand() instanceof GuardCondition
3333
or
3434
// the IR short-circuits if(!x)
3535
// don't produce a guard condition for `y = !x` and other non-short-circuited cases
@@ -98,7 +98,7 @@ class GuardCondition extends Expr {
9898
*/
9999
private class GuardConditionFromBinaryLogicalOperator extends GuardCondition {
100100
GuardConditionFromBinaryLogicalOperator() {
101-
exists(GuardCondition gc | this.(BinaryLogicalOperation).getAnOperand() = gc)
101+
this.(BinaryLogicalOperation).getAnOperand() instanceof GuardCondition
102102
}
103103

104104
override predicate controls(BasicBlock controlled, boolean testIsTrue) {

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowPrivate.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private class Argument extends Expr {
4848
*/
4949
class ArgumentNode extends Node {
5050
ArgumentNode() {
51-
exists(Argument arg | this.asExpr() = arg) or
51+
this.asExpr() instanceof Argument or
5252
this = getInstanceArgument(_)
5353
}
5454

cpp/ql/lib/semmle/code/cpp/exprs/Access.qll

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ class VariableAccess extends Access, @varaccess {
8484
exists(Assignment a | a.getLValue() = this) or
8585
exists(CrementOperation c | c.getOperand() = this) or
8686
exists(AddressOfExpr addof | addof.getOperand() = this) or
87-
exists(ReferenceToExpr rte | this.getConversion() = rte) or
88-
exists(ArrayToPointerConversion atpc | this.getConversion() = atpc)
87+
this.getConversion() instanceof ReferenceToExpr or
88+
this.getConversion() instanceof ArrayToPointerConversion
8989
}
9090

9191
/**
@@ -104,8 +104,8 @@ class VariableAccess extends Access, @varaccess {
104104
predicate isRValue() {
105105
not exists(AssignExpr ae | ae.getLValue() = this) and
106106
not exists(AddressOfExpr addof | addof.getOperand() = this) and
107-
not exists(ReferenceToExpr rte | this.getConversion() = rte) and
108-
not exists(ArrayToPointerConversion atpc | this.getConversion() = atpc)
107+
not this.getConversion() instanceof ReferenceToExpr and
108+
not this.getConversion() instanceof ArrayToPointerConversion
109109
}
110110

111111
/**
@@ -218,9 +218,7 @@ class PointerFieldAccess extends FieldAccess {
218218
class DotFieldAccess extends FieldAccess {
219219
override string getAPrimaryQlClass() { result = "DotFieldAccess" }
220220

221-
DotFieldAccess() {
222-
exists(Class c | c = this.getQualifier().getFullyConverted().getUnspecifiedType())
223-
}
221+
DotFieldAccess() { this.getQualifier().getFullyConverted().getUnspecifiedType() instanceof Class }
224222
}
225223

226224
/**

cpp/ql/lib/semmle/code/cpp/exprs/Call.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Call extends Expr, NameQualifiableElement, TCall {
3535
*
3636
* For example, `ptr->f()` has a qualifier, whereas plain `f()` does not.
3737
*/
38-
predicate hasQualifier() { exists(Expr e | this.getChild(-1) = e) }
38+
predicate hasQualifier() { exists(this.getChild(-1)) }
3939

4040
/**
4141
* Gets the expression to the left of the function name or function pointer variable name.

cpp/ql/lib/semmle/code/cpp/exprs/Cast.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ class SizeofOperator extends Expr, @runtime_sizeof {
724724
* ```
725725
*/
726726
class SizeofExprOperator extends SizeofOperator {
727-
SizeofExprOperator() { exists(Expr e | this.getChild(0) = e) }
727+
SizeofExprOperator() { exists(this.getChild(0)) }
728728

729729
override string getAPrimaryQlClass() { result = "SizeofExprOperator" }
730730

@@ -787,7 +787,7 @@ class AlignofOperator extends Expr, @runtime_alignof {
787787
* ```
788788
*/
789789
class AlignofExprOperator extends AlignofOperator {
790-
AlignofExprOperator() { exists(Expr e | this.getChild(0) = e) }
790+
AlignofExprOperator() { exists(this.getChild(0)) }
791791

792792
/**
793793
* Gets the contained expression.

0 commit comments

Comments
 (0)