Skip to content

Commit a4209df

Browse files
committed
Merge branch 'main' into swift-field-flow-2
2 parents f2d9393 + 5ad6c05 commit a4209df

File tree

507 files changed

+12879
-3339
lines changed

Some content is hidden

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

507 files changed

+12879
-3339
lines changed

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/XML.qll

100755100644
File mode changed.

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/BlockWithTooManyStatements.ql

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,4 @@ where
2929
n = strictcount(ComplexStmt s | s = b.getAStmt()) and
3030
n > 3 and
3131
complexStmt = b.getAStmt()
32-
select b,
33-
"Block with too many statements (" + n.toString() +
34-
" complex statements in the block). Complex statements at: $@", complexStmt,
35-
complexStmt.toString()
32+
select b, "Block with too many statements (" + n.toString() + " complex statements in the block)."

cpp/ql/src/Best Practices/Likely Errors/EmptyBlock.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,4 @@ where
110110
emptyBlock(s, eb) and
111111
not emptyBlockContainsNonchild(eb) and
112112
not lineComment(eb)
113-
select eb, "Empty block without comment"
113+
select eb, "Empty block without comment."

0 commit comments

Comments
 (0)