Skip to content

Commit 60fad4d

Browse files
committed
Merge remote-tracking branch 'upstream/main' into swiftcleanup
2 parents 3e4a6be + bf7437f commit 60fad4d

File tree

356 files changed

+21934
-3838
lines changed

Some content is hidden

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

356 files changed

+21934
-3838
lines changed

config/identical-files.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -584,19 +584,19 @@
584584
],
585585
"Swift declarations test file": [
586586
"swift/ql/test/extractor-tests/declarations/declarations.swift",
587-
"swift/ql/test/library-tests/parent/declarations.swift"
587+
"swift/ql/test/library-tests/ast/declarations.swift"
588588
],
589589
"Swift statements test file": [
590590
"swift/ql/test/extractor-tests/statements/statements.swift",
591-
"swift/ql/test/library-tests/parent/statements.swift"
591+
"swift/ql/test/library-tests/ast/statements.swift"
592592
],
593593
"Swift expressions test file": [
594594
"swift/ql/test/extractor-tests/expressions/expressions.swift",
595-
"swift/ql/test/library-tests/parent/expressions.swift"
595+
"swift/ql/test/library-tests/ast/expressions.swift"
596596
],
597597
"Swift patterns test file": [
598598
"swift/ql/test/extractor-tests/patterns/patterns.swift",
599-
"swift/ql/test/library-tests/parent/patterns.swift"
599+
"swift/ql/test/library-tests/ast/patterns.swift"
600600
],
601601
"IncompleteMultiCharacterSanitization JS/Ruby": [
602602
"javascript/ql/lib/semmle/javascript/security/IncompleteMultiCharacterSanitizationQuery.qll",

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,10 @@ class Class extends UserType {
404404
* compiled for. For this reason, the `is_pod_class` predicate is
405405
* generated by the extractor.
406406
*/
407-
predicate isPOD() { is_pod_class(underlyingElement(this)) }
407+
predicate isPod() { is_pod_class(underlyingElement(this)) }
408+
409+
/** DEPRECATED: Alias for isPod */
410+
deprecated predicate isPOD() { this.isPod() }
408411

409412
/**
410413
* Holds if this class, struct or union is a standard-layout class

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,17 @@ predicate isAggregateType03(Type t) {
7979
* user-defined copy assignment operator and no user-defined destructor.
8080
* A POD class is a class that is either a POD-struct or a POD-union.
8181
*/
82-
predicate isPODClass03(Class c) {
82+
predicate isPodClass03(Class c) {
8383
isAggregateClass03(c) and
8484
not exists(Variable v |
8585
v.getDeclaringType() = c and
8686
not v.isStatic()
8787
|
88-
not isPODType03(v.getType())
88+
not isPodType03(v.getType())
8989
or
9090
exists(ArrayType at |
9191
at = v.getType() and
92-
not isPODType03(at.getBaseType())
92+
not isPodType03(at.getBaseType())
9393
)
9494
or
9595
v.getType() instanceof ReferenceType
@@ -104,6 +104,9 @@ predicate isPODClass03(Class c) {
104104
)
105105
}
106106

107+
/** DEPRECATED: Alias for isPodClass03 */
108+
deprecated predicate isPODClass03 = isPodClass03/1;
109+
107110
/**
108111
* Holds if `t` is a POD type, according to the rules specified in
109112
* C++03 3.9(10):
@@ -112,14 +115,17 @@ predicate isPODClass03(Class c) {
112115
* such types and cv-qualified versions of these types (3.9.3) are
113116
* collectively called POD types.
114117
*/
115-
predicate isPODType03(Type t) {
118+
predicate isPodType03(Type t) {
116119
exists(Type ut | ut = t.getUnderlyingType() |
117120
isScalarType03(ut)
118121
or
119-
isPODClass03(ut)
122+
isPodClass03(ut)
120123
or
121-
exists(ArrayType at | at = ut and isPODType03(at.getBaseType()))
124+
exists(ArrayType at | at = ut and isPodType03(at.getBaseType()))
122125
or
123-
isPODType03(ut.(SpecifiedType).getUnspecifiedType())
126+
isPodType03(ut.(SpecifiedType).getUnspecifiedType())
124127
)
125128
}
129+
130+
/** DEPRECATED: Alias for isPodType03 */
131+
deprecated predicate isPODType03 = isPodType03/1;

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ predicate dependsOnTransitive(DependsSource src, Element dest) {
238238
/**
239239
* A dependency that targets a TypeDeclarationEntry.
240240
*/
241-
private predicate dependsOnTDE(Element src, Type t, TypeDeclarationEntry dest) {
241+
private predicate dependsOnTde(Element src, Type t, TypeDeclarationEntry dest) {
242242
dependsOnTransitive(src, t) and
243243
getDeclarationEntries(t, dest)
244244
}
@@ -247,8 +247,8 @@ private predicate dependsOnTDE(Element src, Type t, TypeDeclarationEntry dest) {
247247
* A dependency that targets a visible TypeDeclarationEntry.
248248
*/
249249
pragma[noopt]
250-
private predicate dependsOnVisibleTDE(Element src, Type t, TypeDeclarationEntry dest) {
251-
dependsOnTDE(src, t, dest) and
250+
private predicate dependsOnVisibleTde(Element src, Type t, TypeDeclarationEntry dest) {
251+
dependsOnTde(src, t, dest) and
252252
exists(File g | g = dest.getFile() |
253253
exists(File f | f = src.getFile() | f.getAnIncludedFile*() = g)
254254
)
@@ -260,8 +260,8 @@ private predicate dependsOnVisibleTDE(Element src, Type t, TypeDeclarationEntry
260260
private predicate dependsOnDeclarationEntry(Element src, DeclarationEntry dest) {
261261
exists(Type t |
262262
// dependency from a Type use -> unique visible TDE
263-
dependsOnVisibleTDE(src, t, dest) and
264-
strictcount(TypeDeclarationEntry alt | dependsOnVisibleTDE(src, t, alt)) = 1
263+
dependsOnVisibleTde(src, t, dest) and
264+
strictcount(TypeDeclarationEntry alt | dependsOnVisibleTde(src, t, alt)) = 1
265265
)
266266
or
267267
exists(TypedefType mid |
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import semmle.code.cpp.Macro
22

33
/** A macro defining NULL. */
4-
class NULLMacro extends Macro {
5-
NULLMacro() { this.getHead() = "NULL" }
4+
class NullMacro extends Macro {
5+
NullMacro() { this.getHead() = "NULL" }
66
}
77

8+
/** DEPRECATED: Alias for NullMacro */
9+
deprecated class NULLMacro = NullMacro;
10+
811
/** A use of the NULL macro. */
912
class NULL extends Literal {
10-
NULL() { exists(NULLMacro nm | this = nm.getAnInvocation().getAnExpandedElement()) }
13+
NULL() { exists(NullMacro nm | this = nm.getAnInvocation().getAnExpandedElement()) }
1114
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ module FlowVar_internal {
474474
}
475475

476476
/** Type-specialized version of `getEnclosingElement`. */
477-
private ControlFlowNode getCFNParent(ControlFlowNode node) { result = node.getEnclosingElement() }
477+
private ControlFlowNode getCfnParent(ControlFlowNode node) { result = node.getEnclosingElement() }
478478

479479
/**
480480
* A for-loop or while-loop whose condition is always true upon entry but not
@@ -526,7 +526,7 @@ module FlowVar_internal {
526526
}
527527

528528
private predicate bbInLoopCondition(BasicBlock bb) {
529-
getCFNParent*(bb.getANode()) = this.(Loop).getCondition()
529+
getCfnParent*(bb.getANode()) = this.(Loop).getCondition()
530530
}
531531

532532
private predicate bbInLoop(BasicBlock bb) {

cpp/ql/lib/semmle/code/cpp/valuenumbering/GlobalValueNumberingImpl.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ private ControlFlowNode mostRecentSideEffect(ControlFlowNode node) {
165165

166166
/** Used to represent the "global value number" of an expression. */
167167
cached
168-
private newtype GVNBase =
168+
private newtype GvnBase =
169169
GVN_IntConst(int val, Type t) { mk_IntConst(val, t, _) } or
170170
GVN_FloatConst(float val, Type t) { mk_FloatConst(val, t, _) } or
171171
// If the local variable does not have a defining value, then
@@ -221,8 +221,8 @@ private newtype GVNBase =
221221
* expression with this `GVN` and using its `toString` and `getLocation`
222222
* methods.
223223
*/
224-
class GVN extends GVNBase {
225-
GVN() { this instanceof GVNBase }
224+
class GVN extends GvnBase {
225+
GVN() { this instanceof GvnBase }
226226

227227
/** Gets an expression that has this GVN. */
228228
Expr getAnExpr() { this = globalValueNumber(result) }

cpp/ql/src/Architecture/Refactoring Opportunities/ClassesWithManyFields.ql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,17 @@ class VariableDeclarationLine extends TVariableDeclarationInfo {
6363
/**
6464
* Gets a `VariableDeclarationEntry` on this line.
6565
*/
66-
VariableDeclarationEntry getAVDE() { vdeInfo(result, c, f, line) }
66+
VariableDeclarationEntry getAVde() { vdeInfo(result, c, f, line) }
6767

6868
/**
6969
* Gets the start column of the first `VariableDeclarationEntry` on this line.
7070
*/
71-
int getStartColumn() { result = min(this.getAVDE().getLocation().getStartColumn()) }
71+
int getStartColumn() { result = min(this.getAVde().getLocation().getStartColumn()) }
7272

7373
/**
7474
* Gets the end column of the last `VariableDeclarationEntry` on this line.
7575
*/
76-
int getEndColumn() { result = max(this.getAVDE().getLocation().getEndColumn()) }
76+
int getEndColumn() { result = max(this.getAVde().getLocation().getEndColumn()) }
7777

7878
/**
7979
* Gets the rank of this `VariableDeclarationLine` in its file and class
@@ -134,13 +134,13 @@ class VariableDeclarationGroup extends VariableDeclarationLine {
134134
count(VariableDeclarationLine l |
135135
l = this.getProximateNext*()
136136
|
137-
l.getAVDE().getVariable().getName()
137+
l.getAVde().getVariable().getName()
138138
)
139139
}
140140

141141
override string toString() {
142142
this.getCount() = 1 and
143-
result = "declaration of " + this.getAVDE().getVariable().getName()
143+
result = "declaration of " + this.getAVde().getVariable().getName()
144144
or
145145
this.getCount() > 1 and
146146
result = "group of " + this.getCount() + " fields here"

cpp/ql/src/Best Practices/UseOfGoto.ql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import cpp
1616
class JumpTarget extends Stmt {
1717
JumpTarget() { exists(GotoStmt g | g.getTarget() = this) }
1818

19-
FunctionDeclarationEntry getFDE() { result.getBlock() = this.getParentStmt+() }
19+
FunctionDeclarationEntry getFde() { result.getBlock() = this.getParentStmt+() }
2020

2121
predicate isForward() {
2222
exists(GotoStmt g | g.getTarget() = this |
@@ -33,8 +33,8 @@ class JumpTarget extends Stmt {
3333

3434
from FunctionDeclarationEntry fde, int nforward, int nbackward
3535
where
36-
nforward = strictcount(JumpTarget t | t.getFDE() = fde and t.isForward()) and
37-
nbackward = strictcount(JumpTarget t | t.getFDE() = fde and t.isBackward()) and
36+
nforward = strictcount(JumpTarget t | t.getFde() = fde and t.isForward()) and
37+
nbackward = strictcount(JumpTarget t | t.getFde() = fde and t.isBackward()) and
3838
nforward != 1 and
3939
nbackward != 1
4040
select fde,

cpp/ql/src/Microsoft/CallWithNullSAL.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import SAL
1313

1414
from Parameter p, Call c, Expr arg
1515
where
16-
any(SALNotNull a).getDeclaration() = p and
16+
any(SalNotNull a).getDeclaration() = p and
1717
c.getTarget() = p.getFunction() and
1818
arg = c.getArgument(p.getIndex()) and
1919
nullValue(arg)

cpp/ql/src/Microsoft/IgnoreReturnValueSAL.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ from Function f, FunctionCall call
1818
where
1919
call.getTarget() = f and
2020
call instanceof ExprInVoidContext and
21-
any(SALCheckReturn a).getDeclaration() = f and
21+
any(SalCheckReturn a).getDeclaration() = f and
2222
not getOptions().okToIgnoreReturnValue(call)
2323
select call, "Return value of $@ discarded although a SAL annotation " + "requires inspecting it.",
2424
f, f.getName()

cpp/ql/src/Microsoft/InconsistentSAL.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import SAL
1111

1212
/** Holds if `e` has SAL annotation `name`. */
1313
predicate hasAnnotation(DeclarationEntry e, string name) {
14-
exists(SALAnnotation a |
14+
exists(SalAnnotation a |
1515
a.getMacro().getName() = name and
1616
a.getDeclarationEntry() = e
1717
)
@@ -21,7 +21,7 @@ predicate hasAnnotation(DeclarationEntry e, string name) {
2121
predicate inheritsDeclAnnotations(DeclarationEntry e) {
2222
// Is directly annotated
2323
e.isDefinition() and
24-
exists(SALAnnotation a | a.getMacro().getName() = "_Use_decl_annotations_" |
24+
exists(SalAnnotation a | a.getMacro().getName() = "_Use_decl_annotations_" |
2525
a.getDeclarationEntry() = e
2626
)
2727
or

0 commit comments

Comments
 (0)