Skip to content

Commit d299ef0

Browse files
authored
Merge pull request github#13106 from kaspersv/kaspersv/cpp-enable-implicit-this-warnings
C++: Enable implicit this warnings
2 parents e1f868b + 8410eb3 commit d299ef0

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

cpp/ql/lib/qlpack.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ dependencies:
99
codeql/ssa: ${workspace}
1010
codeql/tutorial: ${workspace}
1111
codeql/util: ${workspace}
12+
warnOnImplicitThis: true

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import cpp
2525
*/
2626
abstract class StackVariableReachability extends string {
2727
bindingset[this]
28-
StackVariableReachability() { length() >= 0 }
28+
StackVariableReachability() { this.length() >= 0 }
2929

3030
/** Holds if `node` is a source for the reachability analysis using variable `v`. */
3131
abstract predicate isSource(ControlFlowNode node, StackVariable v);
@@ -227,7 +227,7 @@ predicate bbSuccessorEntryReachesLoopInvariant(
227227
*/
228228
abstract class StackVariableReachabilityWithReassignment extends StackVariableReachability {
229229
bindingset[this]
230-
StackVariableReachabilityWithReassignment() { length() >= 0 }
230+
StackVariableReachabilityWithReassignment() { this.length() >= 0 }
231231

232232
/** Override this predicate rather than `isSource` (`isSource` is used internally). */
233233
abstract predicate isSourceActual(ControlFlowNode node, StackVariable v);
@@ -330,7 +330,7 @@ abstract class StackVariableReachabilityWithReassignment extends StackVariableRe
330330
*/
331331
abstract class StackVariableReachabilityExt extends string {
332332
bindingset[this]
333-
StackVariableReachabilityExt() { length() >= 0 }
333+
StackVariableReachabilityExt() { this.length() >= 0 }
334334

335335
/** `node` is a source for the reachability analysis using variable `v`. */
336336
abstract predicate isSource(ControlFlowNode node, StackVariable v);

cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysisStage.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ module RangeStage<
277277
*/
278278
private class SafeCastExpr extends ConvertOrBoxExpr {
279279
SafeCastExpr() {
280-
conversionCannotOverflow(getTrackedType(pragma[only_bind_into](getOperand())),
280+
conversionCannotOverflow(getTrackedType(pragma[only_bind_into](this.getOperand())),
281281
pragma[only_bind_out](getTrackedType(this)))
282282
}
283283
}

cpp/ql/src/qlpack.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ dependencies:
1010
suites: codeql-suites
1111
extractor: cpp
1212
defaultSuiteFile: codeql-suites/cpp-code-scanning.qls
13+
warnOnImplicitThis: true

cpp/ql/test/qlpack.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ dependencies:
55
codeql/cpp-queries: ${workspace}
66
extractor: cpp
77
tests: .
8+
warnOnImplicitThis: true

0 commit comments

Comments
 (0)