Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5370e7d

Browse files
committed
C++: Remove TThisVar
There's no need to model `this` as a variable because it's never reassigned.
1 parent 6a3f5ef commit 5370e7d

1 file changed

Lines changed: 0 additions & 33 deletions

File tree

  • cpp/ql/src/semmle/code/cpp/dataflow/internal

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

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,6 @@ module FlowVar_internal {
220220
or
221221
blockVarDefinedByVariable(sbb, v)
222222
)
223-
} or
224-
TThisVar(SubBasicBlock sbb, ThisExpr t) {
225-
reachable(sbb) and
226-
sbb = any(PartialDefinitions::PartialDefinition p | p.partiallyDefinesThis(t))
227-
.getSubBasicBlockStart()
228223
}
229224

230225
/**
@@ -374,34 +369,6 @@ module FlowVar_internal {
374369
override Location getLocation() { result = sbb.getStart().getLocation() }
375370
}
376371

377-
class ThisVar extends TThisVar, FlowVar {
378-
SubBasicBlock sbb;
379-
380-
ThisExpr t;
381-
382-
PartialDefinitions::PartialDefinition pd;
383-
384-
ThisVar() { this = TThisVar(sbb, t) and pd.partiallyDefinesThis(t) }
385-
386-
override VariableAccess getAnAccess() {
387-
none() // TODO: Widen type to `Expr`.
388-
}
389-
390-
override predicate definedByExpr(Expr e, ControlFlowNode node) { none() }
391-
392-
override predicate definedByReference(Expr arg) { none() }
393-
394-
override predicate definedPartiallyAt(Expr arg) {
395-
none() // TODO
396-
}
397-
398-
override predicate definedByInitialValue(LocalScopeVariable param) { none() }
399-
400-
override string toString() { result = pd.toString() }
401-
402-
override Location getLocation() { result = pd.getLocation() }
403-
}
404-
405372
/** Type-specialized version of `getEnclosingElement`. */
406373
private ControlFlowNode getCFNParent(ControlFlowNode node) {
407374
result = node.getEnclosingElement()

0 commit comments

Comments
 (0)