mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
C++: Remove TThisVar
There's no need to model `this` as a variable because it's never reassigned.
This commit is contained in:
@@ -220,11 +220,6 @@ module FlowVar_internal {
|
||||
or
|
||||
blockVarDefinedByVariable(sbb, v)
|
||||
)
|
||||
} or
|
||||
TThisVar(SubBasicBlock sbb, ThisExpr t) {
|
||||
reachable(sbb) and
|
||||
sbb = any(PartialDefinitions::PartialDefinition p | p.partiallyDefinesThis(t))
|
||||
.getSubBasicBlockStart()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -374,34 +369,6 @@ module FlowVar_internal {
|
||||
override Location getLocation() { result = sbb.getStart().getLocation() }
|
||||
}
|
||||
|
||||
class ThisVar extends TThisVar, FlowVar {
|
||||
SubBasicBlock sbb;
|
||||
|
||||
ThisExpr t;
|
||||
|
||||
PartialDefinitions::PartialDefinition pd;
|
||||
|
||||
ThisVar() { this = TThisVar(sbb, t) and pd.partiallyDefinesThis(t) }
|
||||
|
||||
override VariableAccess getAnAccess() {
|
||||
none() // TODO: Widen type to `Expr`.
|
||||
}
|
||||
|
||||
override predicate definedByExpr(Expr e, ControlFlowNode node) { none() }
|
||||
|
||||
override predicate definedByReference(Expr arg) { none() }
|
||||
|
||||
override predicate definedPartiallyAt(Expr arg) {
|
||||
none() // TODO
|
||||
}
|
||||
|
||||
override predicate definedByInitialValue(LocalScopeVariable param) { none() }
|
||||
|
||||
override string toString() { result = pd.toString() }
|
||||
|
||||
override Location getLocation() { result = pd.getLocation() }
|
||||
}
|
||||
|
||||
/** Type-specialized version of `getEnclosingElement`. */
|
||||
private ControlFlowNode getCFNParent(ControlFlowNode node) {
|
||||
result = node.getEnclosingElement()
|
||||
|
||||
Reference in New Issue
Block a user